How to clear loaded mesh resources

I call Babylonjs through Vue and I load several glb files with SceneLoader.ImportMesh.
Here is part of my code:

BABYLON.SceneLoader.ImportMesh("","static/gltf/", "Tile_+002_+003.glb", scene, function (mesh) {
					    
					});
					BABYLON.SceneLoader.ImportMesh("","static/gltf/", "Tile_+002_+004.glb", scene, function (mesh) {
					    
					});
					BABYLON.SceneLoader.ImportMesh("","static/gltf/", "Tile_+003_+001.glb", scene, function (mesh) {
					  
					});

I want to clear all loaded resources when I leave the model page.What should I do?

I would say, you need to use dispose on each root-Mesh. Also, if you have set, you might want to clear your own global mesh-Arrays.

Another option would be Asset Containers and removeAllFromScene(), if you want to add model (scene) again later.

2 Likes

Thank you very much for your help. I’ll give it a try