Class LevelSystem
public static class LevelSystem
- Inheritance
-
LevelSystem
- Inherited Members
Properties
AdditiveSceneCount
Number of additive scenes currently loaded on top of the current level's base scene.
public static int AdditiveSceneCount { get; }
Property Value
CurrentLevel
Current loaded level that contains main scene
public static LevelReference CurrentLevel { get; }
Property Value
LastLevel
Last loaded level that contains main scene
public static LevelReference LastLevel { get; }
Property Value
LevelPostLoad
Event when level end loading
public static Observable<LevelReference> LevelPostLoad { get; }
Property Value
- Observable<LevelReference>
LevelPreload
Event when level start loading
public static Observable<LevelReference> LevelPreload { get; }
Property Value
- Observable<LevelReference>
LoadingProgress
Normalized [0, 1] loading progress for the current LoadAsync operation. Resets to 0 when loading begins and reaches 1 when all scenes are loaded.
public static ReadOnlyReactiveProperty<float> LoadingProgress { get; }
Property Value
- ReadOnlyReactiveProperty<float>
Methods
LoadAdditiveByAddressAsync(string, bool, AdditiveSceneRole?)
Loads one additive scene by Addressables address (not from LevelSceneDataTableManager). Does not change CurrentLevel or fire level load events.
public static UniTask LoadAdditiveByAddressAsync(string sceneAddress, bool setActiveAfterLoad, AdditiveSceneRole? roleOverride = null)
Parameters
sceneAddressstringAddressables scene address.
setActiveAfterLoadboolWhen true, sets this scene as the active scene after load.
roleOverrideAdditiveSceneRole?
Returns
- UniTask
LoadAsync(LevelReference)
Load level from LevelReference
public static UniTask LoadAsync(LevelReference reference)
Parameters
referenceLevelReference
Returns
- UniTask
LoadAsync(string)
Load level by name
public static UniTask LoadAsync(string levelName)
Parameters
levelNamestring
Returns
- UniTask
RegisterBaseScene(Scene)
Registers the scene that should become active again when using UnloadLastAdditiveAsync(bool, AdditiveSceneRole?) with base restore (typically the Single-mode base scene).
public static void RegisterBaseScene(Scene baseScene)
Parameters
baseSceneScene
UnloadAdditiveAsync()
Explicitly unload all additive scenes belonging to the current level.
public static UniTask UnloadAdditiveAsync()
Returns
- UniTask
UnloadLastAdditiveAsync(bool, AdditiveSceneRole?)
Unloads one additive scene. By default removes the stack top (LIFO).
When unloadOnlyRole is set, removes the topmost entry whose role matches (scan from most recent downward).
public static UniTask<bool> UnloadLastAdditiveAsync(bool restoreRegisteredBaseBeforeUnload = false, AdditiveSceneRole? unloadOnlyRole = null)
Parameters
restoreRegisteredBaseBeforeUnloadboolWhen true, sets RegisterBaseScene(Scene) as active before unloading (if registered). For role-filtered unload, applies when the removed entry is an override role.
unloadOnlyRoleAdditiveSceneRole?When null, unloads the top of the stack only. When set, unloads the first matching role from the top.
Returns
- UniTask<bool>
True if a scene was unloaded, false if none matched or the stack is empty.
UnloadRuntimeAdditiveStackAsync(bool)
Unloads runtime map stack: optional secondary additive first, then primary with base-scene restore.
public static UniTask UnloadRuntimeAdditiveStackAsync(bool hasSecondary)
Parameters
hasSecondarybool
Returns
- UniTask