Class SceneLoads
A class which helps with knowing when a scene has loaded/unloaded.
In Peaks of Yore the ways the built-in scenes load is different to custom levels made in the editor.
Not all objects are loaded in the custom levels on the typical Unity scene load, as they're added in dynamically afterwards.
There's also a difference between full playtest/playing normally and being in the editor switching between the orbit camera and quick playtest. Switching to and from the orbit camera keeps loading/unloading some objects.
This class invokes listeners when the scenes are loaded and unloaded, simplifying the process.
public static class SceneLoads
- Inheritance
-
SceneLoads
- Inherited Members
Methods
AddLoadListener(Action<Scene>, SceneType)
Adds a scene listener for scene loads.
public static void AddLoadListener(Action<Scene> callback, SceneType sceneType = SceneType.Default)
Parameters
callbackAction<Scene>The callback to run on the provided load types
sceneTypeSceneTypeThe types of scene loads to listen for
AddUnloadListener(Action<Scene>, SceneType)
Adds a scene listener for scene unloads.
public static void AddUnloadListener(Action<Scene> callback, SceneType sceneType = SceneType.Default)