Optimised way to change mesh in the scene

I am making a configurator where I need to change the model in the scene.
Currently I am disposing off the old mesh and then rendering the new model but in this process mesh disposes of from the scene and new mesh takes a long time to render on the screen, this degrades the experience.
Any way to optimise this process??

Maybe you should wait for the new one to be ready before killing the previous one?

I am using import mesh to add meshes to the scene because after adding meshes I need their reference so that I can play with their positions
Is there any way in which I can get to know when is the new mesh ready???

ImportMesh callback?

mesh.onReadyObservable should be fine for that

Hi,
I tried this but its not working
SceneLoader.ImportMesh("","",url,scene,function (newMeshes) {
newMeshes[0].onReady = () => {
alert(“Mesh ready!”)
};
}

try this:

SceneLoader.ImportMesh("","",url,scene,function (newMeshes) {
if (newMeshes[0].isReady()) {
alert(“Mesh ready!”)
} else 
newMeshes[0].onReady = () => {
alert(“Mesh ready!”)
};
}

Also are you sure the newMeshes[0] is the good mesh? Most of the time it is a transformnode

Its working for me :+1: