scene.removeMesh does not update inspector

when I perform a scene.removeMesh(mesh,true); I still see the mesh in the inspector. and when I do a scene.addMesh with the same mesh, I see a duplicate of that mesh in the inspector.

i have tried scene.debugLayer.setAsActiveScene() but this does not seem to do anything…

From a memory and performance aspect this seems to have no impact since we are dealing with the same mesh in memory. However from a UX standpoint we want the inspector to represent only the meshes currently in the scene.

Any thoughts into what is happening. Do I need to refresh the inspector after removing the mesh somehow?

it looks like it is working here: Babylon.js Playground could you provide a repro in the playground ?

1 Like

Hello @Anupam_Das just checking in, are you still having issues?

Hello,

I was having the same issue but I figured out why.

The mesh removed was parented to another node.
By removing that ref first (uncommenting line 36 of the playground above), the mesh disappeared from the viewport and the inspector.

1 Like

It’s actually a problem (known issue) with the refreshing of the inspector. The mesh is actually removed but the scene explorer hierarchy is not updated.
There’s a similar one with mesh.dispose(), except when you next click again on the parent, the descendants are updated.

May be a potential fix to be done on the Inspector here? cc @sebavan

Edit: And I forgot to say : “Welcome to our Community” and then, thanks for sharing your experience. I hope that despite of the small glitches here or there :wink: you are still enjoying your time with BJS :smiley:
And meanwhile, have a great day :sunglasses:

Huh, at least on the dispose case here the inspector was updated :thinking:

You are right, it is. I’ve been trying to repro from a use case I had in my scene but that failed here obviously.
In fact, I am disposing of the mesh and then I load a new one with same name and reparent it. At some point, the inspector shows the mesh is still attached to the old parent until I click on this parent. It then moves to the new parent.