Limitation on resource.tile_source() (SOLVED)

Setting a tile source at runtime with resource.tile_source() is apparently only possible by assigning the returned hash to a Why is this? I would rather store these hashes in a local table instead of self.

It is not a big deal either way, but some justification here would be satisfying.

1 Like

Remember that we only ever bundle what is used in your project. Anything that isn’t referenced by something in the scene hierarchy, starting at your bootstrap collection, will not be included. By using a we are able to detect which tilesources you may use and include those.

What also happens is that when you do"moretiles", resource.tile_source("/moretiles.tilesource")) you get a hashed path to the binary data of the “moretiles.tilesource”. This path is what you need later when using go.set() to change tilesource on a tilemap component.

The underlying name of the resource is not guarantueed to be “easy” to guess , and then hash. (e.g. we sometimes merge identical resources).
So we use the property to make it easy for the user.

Also, as a, we follow the established pattern of being able to set the property on the script via the editor’s property view.

I would rather store these hashes in a local table instead of self.

Apart from the semantics of the, the actual value is a hash.
So you should be able to store it in a hash table? Does it not work for you?