Skip to main content
Version: Phaser v4.0.0-rc.6

Types.Scenes

CreateSceneFromObjectConfig

<static> CreateSceneFromObjectConfig

nametypeoptionaldescription
initPhaser.Types.Scenes.SceneInitCallbackYesThe scene's init callback.
preloadPhaser.Types.Scenes.ScenePreloadCallbackYesThe scene's preload callback.
createPhaser.Types.Scenes.SceneCreateCallbackYesThe scene's create callback.
updatePhaser.Types.Scenes.SceneUpdateCallbackYesThe scene's update callback. See {@link Phaser.Scene#update}.
extendanyYesAny additional properties, which will be copied to the Scene after it's created (except data or sys).
extend.dataanyYesAny values, which will be merged into the Scene's Data Manager store.

Type: object

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/CreateSceneFromObjectConfig.js#L1
Since: 3.17.0


SceneCreateCallback

<static> SceneCreateCallback

Can be defined on your own Scenes. Use it to create your game objects.

This method is called by the Scene Manager when the scene starts, after init() and preload().

If the LoaderPlugin started after preload(), then this method is called only after loading is complete.

Type: function

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SceneCreateCallback.js#L1
Since: 3.0.0


SceneInitCallback

<static> SceneInitCallback

Can be defined on your own Scenes.

This method is called by the Scene Manager when the scene starts, before preload() and create().

Type: function

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SceneInitCallback.js#L1
Since: 3.0.0


ScenePreloadCallback

<static> ScenePreloadCallback

Can be defined on your own Scenes. Use it to load assets.

This method is called by the Scene Manager, after init() and before create(), only if the Scene has a LoaderPlugin.

After this method completes, if the LoaderPlugin's queue isn't empty, the LoaderPlugin will start automatically.

Type: function

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/ScenePreloadCallback.js#L1
Since: 3.0.0


SceneTransitionConfig

<static> SceneTransitionConfig

nametypeoptionaldefaultdescription
targetstringNoThe Scene key to transition to.
durationnumberYes1000The duration, in ms, for the transition to last.
sleepbooleanYesfalseWill the Scene responsible for the transition be sent to sleep on completion (true), or stopped? (false)
removebooleanYesfalseWill the Scene responsible for the transition be removed from the Scene Manager after the transition completes?
allowInputbooleanYesfalseWill the Scenes Input system be able to process events while it is transitioning in or out?
moveAbovebooleanYesMove the target Scene to be above this one before the transition starts.
moveBelowbooleanYesMove the target Scene to be below this one before the transition starts.
onUpdatefunctionYesThis callback is invoked every frame for the duration of the transition.
onUpdateScopeanyYesThe context in which the callback is invoked.
onStartPhaser.Types.Scenes.SceneTransitionOnStartCallbackYesThis callback is invoked when transition starting.
onStartScopeanyYesThe context in which the callback is invoked.
dataanyYesAn object containing any data you wish to be passed to the target scene's init / create methods (if sleep is false) or to the target scene's wake event callback (if sleep is true).

Type: object

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SceneTransitionConfig.js#L1
Since: 3.5.0


SceneTransitionOnStartCallback

<static> SceneTransitionOnStartCallback

nametypeoptionaldefaultdescription
durationnumberYes1000The duration, in ms, for the transition to last.

Type: function

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SceneTransitionStartCallback.js#L1
Since: 3.60.0


SceneType

<static> SceneType

Type: Phaser.Scene | Phaser.Types.Scenes.SettingsConfig | Phaser.Types.Scenes.CreateSceneFromObjectConfig | function

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SceneType.js#L1
Since: 3.60.0


SceneUpdateCallback

<static> SceneUpdateCallback

Type: function

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SceneUpdateCallback.js#L1
Since: 3.0.0


SettingsConfig

<static> SettingsConfig

nametypeoptionaldefaultdescription
keystringYesThe unique key of this Scene. Must be unique within the entire Game instance.
activebooleanYesfalseDoes the Scene start as active or not? An active Scene updates each step.
visiblebooleanYestrueDoes the Scene start as visible or not? A visible Scene renders each step.
packfalse | Phaser.Types.Loader.FileTypes.PackFileSectionYesfalseFiles to be loaded before the Scene begins.
camerasPhaser.Types.Cameras.Scene2D.CameraConfig | Array.<Phaser.Types.Cameras.Scene2D.CameraConfig>YesnullAn optional Camera configuration object.
mapObject.<string, string>YesOverwrites the default injection map for a scene.
mapAddObject.<string, string>YesExtends the injection map for a scene.
physicsPhaser.Types.Core.PhysicsConfigYes"{}"The physics configuration object for the Scene.
loaderPhaser.Types.Core.LoaderConfigYes"{}"The loader configuration object for the Scene.
pluginsfalse | *YesfalseThe plugin configuration object for the Scene.

Type: object

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SettingsConfig.js#L1
Since: 3.0.0


SettingsObject

<static> SettingsObject

nametypeoptionaldescription
statusnumberNoThe current status of the Scene. Maps to the Scene constants.
keystringNoThe unique key of this Scene. Unique within the entire Game instance.
activebooleanNoThe active state of this Scene. An active Scene updates each step.
visiblebooleanNoThe visible state of this Scene. A visible Scene renders each step.
isBootedbooleanNoHas the Scene finished booting?
isTransitionbooleanNoIs the Scene in a state of transition?
transitionFromPhaser.SceneNoThe Scene this Scene is transitioning from, if set.
transitionDurationnumberNoThe duration of the transition, if set.
transitionAllowInputbooleanNoIs this Scene allowed to receive input during transitions?
dataobjectNoa data bundle passed to this Scene from the Scene Manager.
packfalse | Phaser.Types.Loader.FileTypes.PackFileSectionNoFiles to be loaded before the Scene begins.
camerasPhaser.Types.Cameras.Scene2D.CameraConfig | Array.<Phaser.Types.Cameras.Scene2D.CameraConfig>NoThe Camera configuration object.
mapObject.<string, string>NoThe Scene's Injection Map.
physicsPhaser.Types.Core.PhysicsConfigNoThe physics configuration object for the Scene.
loaderPhaser.Types.Core.LoaderConfigNoThe loader configuration object for the Scene.
pluginsfalse | *NoThe plugin configuration object for the Scene.

Type: object

Member of: Phaser.Types.Scenes

Source: src/scene/typedefs/SettingsObject.js#L1
Since: 3.0.0