Msg.post(hash("level"), "load") - Hash couldn't be resolved as a receiver when loading collection proxy

In a simple case, when I have a collection proxy below the go and I try to load it in the script that is below the go:

msg.post("#level_1", "load")  -- does work

while:

msg.post(hash("#level_1"), "load")  -- doesn't work

and throws:

ERROR:GAMEOBJECT: Instance '#level_1' could not be found when dispatching message 'load' sent from main:/go#main

Using absolute url doesn’t help there.

In the documentation of msg.post a receiver can be either string/url/nil or hash. Why couldn’t a collection proxy be called by a hash of its name?

1 Like

This will convert into a URL. Same as doing:

msg.post(msg.url("#level_1"), "load") -- does work
msg.post(msg.url(nil, nil, "level_1"), "load") -- does work

This is expects an instance identifier, ie what you get from calling go.get_id([path]).

1 Like