Switching scenarios

I finally got some questions when I switched scenes, could you please help me to answer them? When clicking the “drop-down List” button, A “A” “B” “C” “D” dropdown menu will appear, and when clicking the corresponding menu, it will switch to the corresponding scene.

I put PG below, hoping someone can help me out, thank you very much!

What exactly is your question?

If you want to switch scenes (not scenarios :D), you should unload the old scene by calling dispose on it, and then create a new one. You could also simulate the same effect by removing everything from the existing scene. This is what I’m usually doing, though I’m not sure if there are adverse effects if you do it this way.

It’s not clear to me what your Playground is trying to illustrate. Maybe you can produce a simple example to isolate the problem? It’s generally advisable to keep them as simple as possible so that the BabylonJS community can help you more easily. Coming up with the most basic example possible can also help you identify the problem as you remove the parts that aren’t relevant and make it more difficult to understand.


My problem now is that I have three buttons and three scenes. Clicking the button can switch scenes, such as clicking the first button to display the first scene, clicking the second button to display the second scene, and clicking the third button to display the third scene. I tried to write it this way, but it didn’t work :sob:

What exactly isn’t working? I would suggest simplifying the example, remove all the code that isn’t immediately relevant to the problem [of switching scenes], etc :slight_smile: That way, we will be better able to help you.

1 Like

The documentation has a simple example of switching between scenes here: Using Multiple Scenes | Babylon.js Documentation :slight_smile: