How to reuse texture loaded by AssetsManager in PhotoDome?

When I try to reuse a preloaded AssetsManager texture in a PhotoDome by passing the loaded texture.url in the PhotoDome constructor, the inspector indicates that a new texture (with slightly different parameters) is created, rather than reusing the existing texture.

Is this something I need to be concerned about and if so, is there a way to reuse my loaded texture?

If the URL is the same, the texture file will not be downloaded again but will be loaded from the cache.

But, if you use the task manager, you can get the texture from the texture task itself:

Notice I export the loaded texture to the console. This texture can be (re)used whenever you want, if you keep its reference.

1 Like

Thanks @RaananW yes that’s sort of what I’m doing. On textureTask success I add the task to a global asset tasks array pool for later reuse. I’m saving the task rather than the texture directly as I’m trying to keep my asset loader generic and working for all task types. I was just concerned when I noticed the texture duplicated in the inspector but if it’s not reloaded then it should be fine.

Well, it shouldn’t appear as a new texture if you are reusing the texture object. Only if you use the URL again. Want to share a playground for us to better understand the situation?

1 Like

The PhotoDome takes texture url in its constructor, not the texture itself, so I have no option there.

I’ll try to get a PG done, but it’s probably enough to know that duplicate textures in the inspector doesn’t necessary mean twice the memory usage or performance hit.