Best practice - Remove GUI object from scene

If you want to dispose your GUI elements I believe the simplest and the best way is to use dispose() method - Container | Babylon.js Documentation
But if you will dispose elements with forEach function, it will not work properly. See here - Disposing scene.meshes leaving last meshes? - #4 by labris

Other way is to use your class only one time for creation of elements, then make them visible/invisible when needed.

1 Like