Table of Contents

Class SceneLoads

Namespace
UILib.Patches
Assembly
UILib.dll

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

callback Action<Scene>

The callback to run on the provided load types

sceneType SceneType

The 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)

Parameters

callback Action<Scene>

The callback to run on the provided unload types

sceneType SceneType

The types of scene unloads to listen for