Hash script property issue (SOLVED)

Hi!

I’ve got a problem with using hashes as script properties. I’ve set up the following property:

go.property(“target_id”, hash(“none”))

I’ve then, in the properties panel, set this value to “enemy” (which is the ID of another game object in the same collection).

If I print the value of “self.target_id”, I get the following output:

DEBUG:SCRIPT: hash: [10142380992179540741 (unknown)]

The unknown part looks suspicous. And if I try to use the “target_id”, for example:

local target_position = go.get_world_position(target_id)

I get the following error:

ERROR:SCRIPT: modules/steering.lua:78: Instance (null) not found

What am I doing wrong? Maybe I should use an URL for this and not a hash? If so, how do I declare a property of URL type?

Regards
Robin

Edit: Figured it out! go.property(“target_id”, msg.url("")) gives a property of URL type with a drop down list in the properties panel and this solved the issue I had with the hash.

2 Likes