Change image path on the runtime

Hello world! I was wondering if it was possible to change the path of an image or sprite on the runtime?

Thanks! :slight_smile:

do you mean change gui 2d image?
Or change the texture image?

Or in the application code?
Of so why not remove ‘old’ sprite and create the new one with new path?

Since we can’t change the tint of a GUI.IMAGE (unless you have a solution for that), I have several image of that exact same asset but with different tints. I would like to change the image path at the runtime to change its color… I already think that this solution is a bit ugly but I prefer this solution instead of creating a brand new image.

You may change image source on event with

button.image.source 

Example - https://playground.babylonjs.com/#XCPP9Y#15882

4 Likes

Omg! How could I miss this… Thanks!

1 Like