scenemanager
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scenemanager [2021/02/21 17:00] – 73.95.178.156 | scenemanager [2025/01/15 04:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | **When does scene loading happen?** Scene loading and unloading happens at the start of the Update loop, within the '' | + | ==== When does scene loading happen? |
+ | Scene loading and unloading happens at the start of the Update loop, within the '' | ||
Player Loop Phases: | Player Loop Phases: | ||
- | * Initialization | + | * __Initialization__ |
* Game Loop | * Game Loop | ||
* Early Update | * Early Update | ||
- | * `UpdatePreloading` | + | * __UpdatePreloading__ |
+ | * FixedUpdate | ||
* Update | * Update | ||
Line 18: | Line 20: | ||
During the '' | During the '' | ||
- | The scene loading pipeline only seems to execute a single operation, every other frame. | + | The scene loading pipeline only seems to execute a single operation, every other frame.< |
* Frame N+0: Scene1 | * Frame N+0: Scene1 | ||
- | * Frame N+1: ---- | + | * Frame N+1: --- |
* Frame N+2: Scene 2 | * Frame N+2: Scene 2 | ||
- | * Frame N+3: ---- | + | * Frame N+3: --- |
* Frame N+4: Scene 3 | * Frame N+4: Scene 3 | ||
Line 29: | Line 31: | ||
==== Initialization ==== | ==== Initialization ==== | ||
- | The Engine | + | The Engine |
- | + | ||
- | The Unity scene flushing pipeline | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | (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. | + | |
+ | **All** AsyncOperations that are queued during initialization are fully loaded during initialization. For example, if '' | ||
+ | Scene unloads are probably flushed if they are in the pipeline, too.< | ||
===== Build Pipeline ===== | ===== Build Pipeline ===== | ||
- | Scenes are built during standalone in the following way: ' | + | Scenes are built during standalone |
- The active scenes are closed. | - The active scenes are closed. | ||
- Each Scene in the BuildSettings is opened. At this point prefabs are still prefab instances. | - Each Scene in the BuildSettings is opened. At this point prefabs are still prefab instances. | ||
- | - EditorSceneManager.sceneOpened callback is called. | + | - '' |
- Prefabs in the scene are flattened (turned into normal game objects). | - Prefabs in the scene are flattened (turned into normal game objects). | ||
- [[IProcessScene]] and PostProcessScene callbacks are called. | - [[IProcessScene]] and PostProcessScene callbacks are called. | ||
- The final scene file is saved into the standalone build file. | - The final scene file is saved into the standalone build file. | ||
- | - Repeat for next scene | + | - Repeat for next scene. |
===== Sample Scene Load (Editor) ===== | ===== Sample Scene Load (Editor) ===== | ||
Line 59: | Line 55: | ||
* Prefabs.MergePrefabs (turning prefabs into gameobjects) happens before any other callback. (editor only) | * Prefabs.MergePrefabs (turning prefabs into gameobjects) happens before any other callback. (editor only) | ||
* Lightmapping is applied / loaded after Awake/ | * Lightmapping is applied / loaded after Awake/ | ||
- | * SceneManager.sceneLoaded happens after PostProcessScene; | + | * SceneManager.sceneLoaded happens after PostProcessScene. |
{{ : | {{ : | ||
Line 65: | Line 61: | ||
===== Scattered Notes ===== | ===== Scattered Notes ===== | ||
* During a scene load (ie. Awake) the loading scene has '' | * During a scene load (ie. Awake) the loading scene has '' | ||
- | * During a scene unload (ie. Destroy) the unloading scene has '' | + | * During a scene unload (ie. Destroy) the unloading scene has '' |
+ | * '' | ||
+ | * When using '' | ||
Line 72: | Line 70: | ||
===== API Notes: ===== | ===== API Notes: ===== | ||
=== SceneManager.sceneLoaded === | === SceneManager.sceneLoaded === | ||
- | * Called *after* the loaded Scene Awakes. | + | * Called |
scenemanager.1613926833.txt.gz · Last modified: 2025/01/15 04:35 (external edit)