Phaser API Documentation

add(key, sceneConfig, [autoStart], [data])


Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set.


name type arguments Default description
key string

A unique key used to reference the Scene, i.e. MainMenu or Level1.

sceneConfig function | Phaser.Scene | Phaser.Types.Scenes.SettingsConfig | Phaser.Types.Scenes.CreateSceneFromObjectConfig

The config for the Scene

autoStart boolean <optional> false

If true the Scene will be started immediately after being added.

data object <optional>

Optional data object. This will be set as and passed to Scene.init, and Scene.create.


The added Scene, if it was added immediately, otherwise null.

Since: 3.0.0
Source: src/scene/ScenePlugin.js (Line 438)