Skip to main content

LoadScenes

A class in Root.Township, the global namespace.

Loads a list of scenes (by default System Managers), additively unless set otherwise, skipping any already loaded or loaded before by any LoadScenes.

Constructors​

MemberWhat it is
LoadScenes()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private static HashSet<string> allScenesStatic set of scene names loaded or requested so far.
private float delaySeconds to wait before loading. 0 or less loads at once (default -1).
private bool isLoadAsyncLoad with LoadSceneAsync instead of LoadScene.
private bool isLoadingOnAwakeLoad automatically in Awake (default true).
private LoadSceneMode loadSceneModeUnity load mode (default additive).
private static Logger loggerClass logger, logs each scene loaded.
private string[] scenesToLoadNames of the scenes to load.

Methods​

MemberWhat it is
void Load()Loads the scenes now, or after delay seconds if it is above 0.
4 private and internal methods
MemberWhat it is
private void Awake()Loads the scenes if isLoadingOnAwake is set.
private void InitializeScenes()On first use, fills the shared set with the scenes already open.
private void LoadSceneArray(string[] scenes)Loads each scene not yet in the shared set, sync or async, and adds it to the set.
private IEnumerator SceneDelay() (iterator)Coroutine: waits delay seconds, then loads the scenes.

Used in​

Members of other types that take, return or hold a LoadScenes: