Skip to main content

Class SceneLoader

A component providing methods for asynchronously loading scenes.

public class SceneLoader : MonoBehaviour

Inheritance​

Properties​

IsLoading​

Indicates whether a scene loading operation is currently in progress.

public bool IsLoading { get; }

Property Value​

bool

Methods​

LoadScenesSequenceCoroutine(AssetReference, LoadSceneMode)​

Loads a scene asynchronously while broadcasting progress via the event aggregator.

public IEnumerator LoadScenesSequenceCoroutine(AssetReference sceneReference, LoadSceneMode mode = LoadSceneMode.Single)

Parameters​

NameTypeDescription
sceneReferenceAssetReferenceThe asset reference to the scene that should be loaded.
modeLoadSceneModeThe loading mode (Single or Additive).

Returns​

IEnumerator — An enumerator used to run the coroutine.

Remarks​

This method uses an event aggregator to publish LoadingProgressMessage updates during the loading process. Once loading completes, it activates the loaded scene and waits briefly before concluding.

LoadScenesSequenceCoroutine(AssetReference[])​

Loads a sequence of scenes asynchronously in additive mode while broadcasting its progress via the event aggregator.

public IEnumerator LoadScenesSequenceCoroutine(AssetReference[] sceneReferences)

Parameters​

NameTypeDescription
sceneReferencesAssetReference[]An array of scene references to load sequentially.

Returns​

IEnumerator — An enumerator for use with a coroutine.

Remarks​

This method iterates over all provided scenes, loading each one additively using SceneLoadOperation. During loading, progress is published via an IEventAggregator using LoadingProgressMessage. Once all scenes are loaded, the final scene is activated and a short delay ensures smooth transition before completion.

  • Properties
    • IsLoading
  • Methods
    • LoadScenesSequenceCoroutine(AssetReference, LoadSceneMode)
    • LoadScenesSequenceCoroutine(AssetReference[])