Multiscene editing in Unity, blessed be it, permits the launching (via Editor Play mode) of the current scenes, in their current hierarchical state.
However, building and running the project doesn't recognise the current scene setup in the editor, and starts with whatever is set in the Build Settings.
Is there some way to make builds aware of the current editor state of Multi-scene editing hierarchy, and build and run that setup?
1. Getting the editor scenes into the build settings
First for collecting the settings you can use an editor script using
loadedScenes so make a list of only scenes with isLoaded = true1.a. Update on MenuItem click
I made it an extra button in the menu since you might not want to have it always automatically.
Updating on menu button
1.b. Update automaticly on (un)loading scenes
If you want it happening automatically you could also add the call as callback to EditorSceneManager.sceneOpened and EditorSceneManager.sceneClosed using InitializeOnLoad and a static constructor to get the callbacks added after recompile or opening the UnityEditor like
Using automatic update
1.c. Enable/Disable automatic updates
If you want more control you can also add extra menu entries for enabling and disabling the automatic updates like
Note since this uses the
UnityEditornamespace you should either place this script in anEditorfolder or use proper pre-processors like2. Loading all scenes from the build settings
Than later when running the app in the first scene there should be a script responsible for loading all those scenes. Something like e.g.
refs: