Skip to content

ISceneManager Interface

Manages scene lifetime, transitions, and loading screens. Inject this to trigger scene navigation from within your game code.

public interface ISceneManager

Derived
SceneManager

Remarks

\<b>Single deferred slot:\</b> when a LoadScene call is made during Update, OnEnter, or while a load is already in flight, it is queued for execution at the end of the current frame. Only \<b>one\</b> transition can be queued per frame — a second call throws System.InvalidOperationException to prevent silently losing an in-flight request. If multiple systems might independently request a transition in the same frame, coordinate them externally to ensure only one fires per frame.

Properties
CurrentScene Gets the currently active scene, or null if no scene is loaded.
Methods
LoadScene(Type, ISceneTransition, LoadingScene, CancellationToken) Requests a scene transition by runtime System.Type. Use for data-driven flows where the scene type is not known at compile time.
LoadScene<TScene,TLoadingScene>(ISceneTransition, CancellationToken) Requests a scene transition with a loading screen displayed during the load.
LoadScene<TScene>(ISceneTransition, CancellationToken) Requests a scene transition. Fire-and-forget: the load runs in the background and the returned task does not represent load completion. React to the transition in the target scene's Scene.OnEnter or handle failures via SceneLoadFailed.
LoadScene<TScene>(Func<IServiceProvider,TScene>, ISceneTransition, LoadingScene, CancellationToken) Requests a scene transition using a factory function. Use when you need to pass runtime data that DI alone cannot provide.
Events
SceneLoadFailed Raised when a scene load fails. Subscribe to load a fallback or error scene. The handler is invoked on the main thread after BeginFrame, so calling LoadScene<TScene>() from within the handler will defer correctly.