Gui.set_texture only works for dynamically created textures? (SOLVED)

I’m trying to change the texture of a box node at runtime using gui.set_texture, but it only seems to work if i define a new texture with gui.new_texture

I’m loading images from a gui atlas, and I get the dropdown of all the various images in the box node.

how can I dynamically change which texture image is being shown?

1 Like

You need to use gui.play_flipbook() to change to another image from the same atlas.

3 Likes

ah. I see I didn’t realize.

I first had to turn all my images in my atlas into animation groups.

then i was able to use the animation group ID with gui.play_flipbook()

works wondrously, thank you.

1 Like

I actually don’t think you need to make them animation groups, you should be able to use gui.play_flipbook anyway, just providing the image name

1 Like

Yes, there’s no need to create animation groups for single images.

I tried passing just the image name and it didn’t work. Does it have to be the whole image name including the extension?

No, you shouldn’t include the extension. So it should be gui.play_flipbook(my_node, "foobar") and not gui.play_flipbook(my_node, "foobar.png")