How to get the sprite of a gameobject in code?

You can use fragment:

local id = factory.create("#unit_factory", vmath.vector3(0, 0, 0))
local sprite_3 = msg.url(id)
sprite_3.fragment = "sprite"
msg.post(sprite_3, "disable")
5 Likes