How to change Sprite textures?

Hi all. I’m trying to learn if a graphics technique is possible natively in Defold.

At runtime I’d like to choose several arbitrary textures from the project assets and send them to a game object sprite’s material for use in the fragment program.

I’ve searched the forum and it looks like maybe the only way to do this is through the ImageLoader extension. Is that correct, or is there a native method I haven’t found?

How many textures do you have in total?

You can use game object resource properties to reference multiple atlases and change at runtime.

Or you can use the image loader and most from file at runtime and replace atlas on a sprite


Thanks @britzl ! I think the ImageLoader makes the most sense then. It’s a lot of textures so the atlas approach would be a bit cumbersome :sweat_smile:

1 Like