Switch between multiple scenes with observables

I have two scenes with observables on each of them. When I render scene1 I expect observables on the other scene to be disabled, but this is not how it works. The example code is in the playground.

When scene2 is rendered, the button on scene1 is still available (even not visible), and you can still click it.

Please see https://www.babylonjs-playground.com/#SJRBPC

Is there a standard way to do this kind of scene switching?

Hi @felix-indoing and welcome to the forum. Not entirely sure but would think it was something to do with 3DGUI controls being on a utility layer

Once instantiated, the manager will create a utility layer which is a specific child scene that will host all the meshes used to render the controls. This way, your main scene won’t get populated by the utility meshes.

Switching scenes appears to still leave their utility layers functioning.


You need to remove/disable the button from the previous scene, as it is active across all the scenes.