We currently load a lot of models and in order to manage meshes and textures, we use setEnabled(false)
on meshes that are not in use, and dispose of textures when a model is removed from the scene. This works OK, but when we add lots of models to hide and show, then the list of meshes to “unhide” becomes longer and the application performance suffers. In addition, we have to reload textures and apply them again.
In Asset Containers, there appears to be some black magic going on. When a mesh and its textures are added to an asset container and removeAllFromScene()
is called, those entities no longer appear in the list of scene textures or meshes, and they don’t appear in the Inspector. But if I add them back in using addAllToScene()
then the textures come back but I don’t see them loaded in the network tab in Chrome. So my questions:
- Are asset containers the right way to hide a mesh, its submeshes and their materials and textures?
- Where do the textures go? Are they still in the GPU or are they cached in RAM or local storage?
- Are there known limitations to how many Asset Containers I can have? What if each container holds an entire GLTF with submeshes and all their materials? Will that still be the most efficient way to solve the issue?
Thanks!