Class SceneManager

The SceneManager provides an API to all currently loaded and active SceneInstance and their associated ScenePlayData.

Constructors

Accessors

Methods

  • Get all the scene objects from the current scene.

    Parameters

    Returns SceneObject[]

    An array containing all the scene objects.

  • Get all the scene objects from the given scene object root.

    Parameters

    • root: SceneObject

      The root object to get the Scene Objects from.

    • Optionalfilter: ((object: SceneObject) => boolean)
        • (object): boolean
        • Parameters

          Returns boolean

    • OptionalincludeInternal: boolean

      Whether we should include internal Scene Objects.

    Returns SceneObject[]

    An array containing all the scene objects.

  • Searches for all components of a specific type.

    Type Parameters

    • T extends Component

      Type of the component to search for. Includes any components derived from the type.

    Parameters

    • type: ClassOf<T>

      The component type to search for.

    • sceneInstance: SceneInstance

      The scene instance to search in.

    • OptionalactiveOnly: boolean

      If true, only active components are returned. Defaults to true.

    Returns T[]

    All components matching the specified type.

  • Transitions from one scene to another. The transition will be executed once all updates (such as Component updates) for all scenes have finished processing. Transitions will be executed in the order they were requested.

    During the transition, all scene objects listed in persistentObjects will be moved from the fromScene and parented to the root of the toScene. All other objects in the fromScene will be destroyed when the transition is complete. The render target currently assigned to the main camera of the fromScene will be unassigned during the transition and reassigned to the main camera of the toScene after the transition is complete.

    Before the transition starts, the willTransitionScene event is triggered. After the transition is complete, the didTransitionScene event is triggered and the fromScene is immediately destroyed.

    Parameters

    • fromScene: SceneInstance

      The scene to transition from.

    • toScene: SceneInstance

      The scene to transition to.

    • persistentObjects: SceneObject[]

      List of scene objects that should be kept persistent during the transition

    Returns boolean

    True if the transition was successful, false otherwise.

Events

onSceneObjectDestroyed: Event<[number, UUID], void>

Event that triggers right after a scene object gets destroyed. Parameters passed are sceneRuntimeID:number, sceneObjectUUID:UUID.

didTransitionScene: Event<[SceneInstance, SceneInstance], void>

Event that triggers right after a scene transition occurred upon calling transitionScene.

transitionScene