[SOLVED] How to switch scenes

Neither the documentation nor any available tutorial states how to change currently rendered scenes. To organize my work I’d like to create many scenes like MainMenu aqnd separate levels, but how do I exactly manage the level/scene switching? How to load my first level scene from main menu scene?

Hi,

Welcome to the community.

From a script you can do:

SceneSystem.SceneInstance.Scene = Content.Load<Scene>("some scene");

(You can also load scene async if desired)

BTW You should ask these these sort of questions over at the Q&A Site. Looks like someone already asked a similar question “Scene loading”.

cheers,
dfkeenan

2 Likes

Hello @MaKiPL

Welcome.

@dfkeenan is correct and a few samples actually illustrates this. For example the particles sample (since version 1.8) has a script named “NextSceneScript”.

Note that scene streaming might change this in the future (see the roadmap).

2 Likes