Change Texture of ImageElement

So i have an image element and i change it’s texture this way.

imgElementEntity.element.texture = newTexture.resource;

I’m logging the names of the old and new texture and it seems to have been changed, but no visual changed has happenned.
Do i have to updade something? What did i left behind?
Thanks for the help.

1 Like

Please post a link to a small repro scene.

I’ve made a small repro scene, but everything worked as expected in this scene. I will take another good look at my code, maybe i find something wrong.

I’ve got to reproduce it. It seems the problem is when cloning the object.
The clone is created with the old texture.

Interesting. If I run with engine v1.7.0, it works:

But it doesn’t with engine v1.7.1:

I’ll see if I can determine what changed to alter this behavior. Stay tuned… :slight_smile:

OK, this is the commit that changed the behavior:

CC @dave

I’ve entered the following issue on the engine’s GitHub repo:

Please subscribe to that for updates on a fix. :slight_smile:

Hi @will is it still not fixed, I am facing the same issue.
entity.element.texture is always null
I have printed entity.element and it prints whole object which have texture in it.

@Faiq_Laiq Can you post a small repro project for use to take a look at please?

Caught the error, my asset’s preload was off. That’s why not able to assign texture.
Though “loaded” value was “true” and “loading” value was “false”. So if asset was not loaded due to preload off, how can I know that an asset is loaded or not?

Check if the asset resource is null or not