Preloading all scenes to remove scene switch delay
We have designed a house with several rooms. One entering a door you are taken to another room. Each room is a scene. Currently we are doing Scene.LoadLevelAsnyc
which takes 2-3 seconds to switch. Since there are only 5 rooms and memory is not a problem, is there a way to preload all the scenes at the beginning and simply hide/show the corresponding game objects from every scene.
This is something I came up with but does not work. For all scenes in my build setting, in the beginning I do: Application.LoadLevelAdditive (i);
Then I try to set a scene as active scene based on whichever room I have to be and I set game objects in other room as inactive. Each scene has a single root game object to ease disabling objects in that room. This is not working.
SceneManager.SetActiveScene (activeScene); // to set scene active
for (int i = 0; i < SceneManager.sceneCount; i++) {
Scene scene = SceneManager.GetSceneAt (i);
if (i != activeSceneIndex) {
scene.GetRootGameObjects () [0].SetActive (false);
}
}
Answer by TheGri108 · Dec 25, 2017 at 09:56 AM
https://answers.unity.com/questions/1247692/is-it-possible-to-use-loadsceneasync-to-load-multi.html
Check the Answer by Harinezumi at the bottom of the page and see if that rings up any thoughts.
Your answer
![](https://koobas.hobune.stream/wayback/20220612142334im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
,delay after dying and going back to main menu (new scene) 0 Answers
Need a Script for Changing Scenes after pressing E to open locked door once a key has been found. 0 Answers
Why is my scene not loading? 2 Answers
PLEASE HELP!!! 0 Answers
Loading a scene with script loads multiple copies of another scene, the crashes Unity 0 Answers