Skip to content

KernelAPI reference

Class SceneManager

Namespace: MicroEngine.Scenes
Assembly: MicroEngine.dll
Guide: Scenes

Manages the scene stack and the transitions between scenes.

C#
public sealed class SceneManager

Inheritance

object ← SceneManager

Properties

Count

Number of scenes on the stack.

C#
public int Count { get; }

Property Value

int

Current

The top scene, or null when the stack is empty.

C#
public Scene? Current { get; }

Property Value

Scene?

InTransition

Whether a transition is playing.

C#
public bool InTransition { get; }

Property Value

bool

Stack

The scenes from bottom (index 0) to top.

C#
public IReadOnlyList<Scene> Stack { get; }

Property Value

IReadOnlyList<Scene>

Methods

Pop(Transition?)

Removes the top scene, deferred like Push. The scene below receives Resume. Does nothing on an empty stack.

C#
public void Pop(Transition? transition = null)

Parameters

transition Transition?

Push(Scene, Transition?)

Puts scene on top of the stack. The change is deferred: it applies before the next update (or after Game’s Load), or halfway through transition when one is given.

C#
public void Push(Scene scene, Transition? transition = null)

Parameters

scene Scene

transition Transition?

Remarks

Changes keep the order they were requested in. A change requested while a transition plays drops its own transition; until the playing transition has swapped its scenes, it waits and applies right after the swap.

Push<TResult>(Scene<TResult>, Action<TResult>, Transition?)

Pushes a scene that returns a value, deferred like Push: when it calls Finish, it is popped and onResult receives the value (after the scene’s Exit, before the scene below receives Resume).

C#
public void Push<TResult>(Scene<TResult> scene, Action<TResult> onResult, Transition? transition = null)

Parameters

scene Scene<TResult>

onResult Action<TResult>

transition Transition?

Type Parameters

TResult

Replace(Scene, Transition?)

Replaces the top scene.

C#
public void Replace(Scene scene, Transition? transition = null)

Parameters

scene Scene

transition Transition?

Reset(Scene, Transition?)

Clears the stack and starts over with scene.

C#
public void Reset(Scene scene, Transition? transition = null)

Parameters

scene Scene

transition Transition?