This is an old revision of the document!
SceneManager.sceneLoaded
is called *after* the loaded Scene Awakes. Scene Loading always happens at the start of the Update loop, within the EarlyUpdate
phase of the PlayerLoop.
The Unity scene flushing pipeline works differently in the initialization phase of the player. Scene loads thats are queued during initialization are blocked and fully loaded before the game starts. For example, if SceneManager.LoadSceneAsync is called in the Awake of the very first scene (ie. called before the first Update), then the engine will wait to fully load that scene as well, before starting the first Update.
It is untested if this is also the case for SceneManager.UnloadSceneAsync
. However, because Unity documentation mentions that that the scene loading queue is a pipeline, and only one AsyncOperation can progress at a time, I would suspect that the Engine simply “flushes” the scene loading queue during initialization.
Phases:
(The scene load pipeline is fully flushed) I don't yet know how it handles unloads if they are in the pipeline then, so if we need this behaviour we should debug and see how it works. If scene unloads get flushed too, we'll need to add a bit of logic for it, in the same way LoadSceneAsync does.
The scene loading pipeline only seems to load one scene, every other frame. That is to say if you have 3 small scenes in the pipeline (Scene1, Scene2, Scene3), loading additively, the engine will load them at the following times:
Scenes are built during standalone in the following way: '
Here is an example of a scene loading additively in the middle of a game, in the editor. Note that: