I currently have a loaded scene with a model of a house (for this scenario, let’s just call this as house A). I used BABYLON.SceneLoader.AppendAsync to load it.
If I were to create a button the lets me upload a new model of house (presumably House B). How will I able to properly replace House A with House B?
Since both are .gltf models, I thought replacing the path of the BABYLON.SceneLoader.AppendAsync would make it work. but it seems it doesn’t.
If that’s the case will I be able to keep the textures that I’ve set in House A or do I have to recreate all the saved textures? (assuming for example both houses have the same names or uses the same name of mesh)
I am pretty sure that meshes loaded from separate files cannot share the same materials. Materials names also do not have to be unique.
According to this, all textures are cached by default, presumably by url, so they would not need to be gotten again. Personally, wish to disable this feature & nuke the cache once all me loading is done. It seems like just a waste of RAM, but find no info on my search, @Deltakosh ?
Materials can be shared within a given load though. When a mesh is disposed, any material used does not automatically get disposed, the 2nd optional argument does allow you to control it though.
Keeping the materials in your case would seem to be only useful if you created and applied materials to the meshes, after they got loaded. You could verify whether keeping them helps by:
adding the inspector to your scene
If there are 2 copies of materials with the same name, then there is no point in keeping the old materials around.