Can be used to dynamically load and unload extra content
Available scenes are defined in the scenes array.

events

  • loadscene-start: Called when a scene starts loading
  • loadscene-finished: Called when a scene finished loading
  • progress: Called when a scene is loading and the progress changes Subscribe to events like this: sceneSwitcher.addEventListener("loadscene-start", (e) => {...})

Hierarchy (view full)

Properties

preloadConcurrent: number = 2

how many scenes can be loaded in parallel

preloadNext: number = 1

how many scenes after the currently active scene should be preloaded

preloadPrevious: number = 1

how many scenes before the currently active scene should be preloaded

queryParameterName: string = "scene"

the url parameter that is set/used to store the currently loaded scene in, set to "" to disable

useHistory: boolean = true

when enabled the new scene is pushed to the browser navigation history, only works with a valid query parameter set

useKeyboard: boolean = true

when enabled you can switch between scenes using keyboard left, right, A and D or number keys

useSceneLighting: boolean = true

when enabled will automatically apply the environment scene lights

useSceneName: boolean = true

when enabled the scene name will be used as the query parameter (otherwise the scene index will be used) Needs queryParameterName set

useSwipe: boolean = true

when enabled you can switch between scenes using swipe (mobile only)

Accessors

  • get activeAndEnabled(): boolean
  • Returns boolean

  • get context(): Context
  • Returns Context

  • set context(context): void
  • Parameters

    Returns void

  • get currentIndex(): number
  • The index of the currently loaded and active scene

    Returns number

  • get currentLoadingProgress(): ProgressEvent<EventTarget>
  • Get the progress of the currently loading scene. This is undefined if no scene is loading
    You can also subscribe to the loading event by adding an event listener to the scene switcher.
    For example like this sceneSwitcher.addEventListeneer("progress", (e) => {...})

    Returns ProgressEvent<EventTarget>

  • get destroyed(): boolean
  • Returns boolean

  • get enabled(): boolean
  • Returns boolean

  • set enabled(val): void
  • Parameters

    • val: boolean

    Returns void

  • get forward(): Vector3
  • Forward (0,0,-1) vector in world space

    Returns Vector3

  • get hideFlags(): HideFlags
  • Returns HideFlags

  • get isComponent(): boolean
  • Returns boolean

  • get layer(): number
  • Returns number

  • get name(): string
  • Returns string

  • set name(str): void
  • Parameters

    • str: string

    Returns void

  • get right(): Vector3
  • Right (1,0,0) vector in world space

    Returns Vector3

  • get scene(): Scene
  • Returns Scene

  • get static(): any
  • Returns any

  • get tag(): string
  • Returns string

  • set tag(str): void
  • Parameters

    • str: string

    Returns void

  • get up(): Vector3
  • Up (0,1,0) vector in world space

    Returns Vector3

  • get worldEuler(): Euler
  • Returns Euler

  • set worldEuler(val): void
  • Parameters

    • val: Euler

    Returns void

  • get worldPosition(): Vector3
  • Returns Vector3

  • set worldPosition(val): void
  • Parameters

    • val: Vector3

    Returns void

  • get worldQuaternion(): Quaternion
  • Returns Quaternion

  • set worldQuaternion(val): void
  • Parameters

    • val: Quaternion

    Returns void

  • get worldRotation(): Vector3
  • Returns Vector3

  • set worldRotation(val): void
  • Parameters

    • val: Vector3

    Returns void

Methods

  • Type Parameters

    Parameters

    • type: string
    • listener: ((evt) => any)
        • (evt): any
        • Parameters

          • evt: T

          Returns any

    Returns void

  • called once when the component becomes active for the first time

    Returns void

  • called every time when the component gets enabled (this is invoked after awake and before start)

    Returns void

  • Called for all scripts when the context gets paused or unpaused

    Parameters

    • isPaused: boolean
    • wasPaused: boolean

    Returns void

  • called when you decorate fields with the @validate() decorator

    Parameters

    • Optional prop: string

    Returns void

  • Type Parameters

    Parameters

    • type: string
    • listener: ((arg) => any)
        • (arg): any
        • Parameters

          • arg: T

          Returns any

    Returns void

  • called on a component with a map of old to new guids (e.g. when instantiate generated new guids and e.g. timeline track bindings needs to remape them)

    Parameters

    • guidsMap: GuidsMap

    Returns void

  • Parameters

    • index: string | number

    Returns Promise<boolean>

  • Parameters

    • x: number
    • y: number
    • z: number
    • w: number

    Returns void

  • Parameters

    • x: number
    • y: number
    • z: number
    • degrees: boolean = true

    Returns void

  • Parameters

    • routine: Generator<unknown, any, unknown>
    • evt: FrameEvent = FrameEvent.Update

    Returns void

Generated using TypeDoc