Proper way of accessing material properties in objects spawned by a factory (SOLVED)

Hello,

I am currently trying to get/set a custom property of an object created by a collection factory. Unfortunately I keep getting the following error:

‘[explore:/collection6/tile]’ does not have any property called ‘tint’

local block = collectionfactory.create("#block_factory", pos, nil, {}, self.scale_level)
msg.post(block[hash("/tile")], "play_animation", {id = hash(self.image[tile_style])}) -- I don't seem to have any issues addressing the tile GO
print(go.get(msg.url(block[hash("/tile")]), "tint")) -- this command however throws out an error

Is there something I am missing?

1 Like

The tint is not on the game object is it? It’s probably on a component, perhaps a sprite or script? The url should be something like:

go.get(msg.url(nil, block[hash("/tile")], "spritecomponentid"), "tint")
2 Likes

Awesome, that has fixed it. Thanks for a quick reply!