Way to dispose all the assets loaded from a file (GLTF) leaving intact the rest of scene

I believe the easiest way which gives the full control is to create an array with the list of imported meshes. When you need to dispose the loaded GLTF just dispose meshes from this list until it will be clear.
Mesh.dispose() has the flag disposeMaterialAndTextures to dispose associated materials and textures when true - Mesh | Babylon.js Documentation
To dispose animations associated with the mesh one needs to go through the array of mesh.animations - Mesh | Babylon.js Documentation

1 Like