Hash property unknown, when only defined in game object file (SOLVED)

Hello!

Let’s take a simple script:

go.property("name", hash(""))

function init(self)
    print("Name:", self.name)
end

And add it to game object. In game object I change property to: “go”:

And when I use this object in collection I want it to use this name, so I don’t change it here:

As you can see in the console the self.name is though “unknown”. It thought it will be “go”, because that’s what is set “by default”. Is this a bug? How can I set a default name for such game object to be used every time I put it in collection? Is there a related documentation fragment?

It looks like it is only possible to set the name in game object in collection:

This repro:
hash_property.zip (14.7 KB)

P.S.

The other problem is even though I will set the name at the game object used in collection, but when I create this collection using a factory, I get also “unknown”:

If you compare the hash value with ’hash(”go”)’, will that match?

We don’t store the debug strings for the hashes during the content build.
If you hash it at runtime, in a debug build, then it will print out the steing.

We have also improved the ’unknown’ output in the next release, so that you’ll see the hash value too.

1 Like

Here is a ticket about it Hash script property doesn't get reversed · Issue #7422 · defold/defold · GitHub

1 Like

Ok, thank you for explanation! :wink: