Skip to content

Commit a1265a2

Browse files
committed
The return from the ScenePlugin.add method has changed. Previously, it would return the ScenePlugin, but now it returns a reference to the Scene that was added to the Scene Manager, keeping it in-line with all other add methods in the API. Fix phaserjs#4359
1 parent f9e6f2c commit a1265a2

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Removed all references to CocoonJS from the API, including in the Device.OS object and elsewhere, as Cocoon is no longer.
1212
* The MouseManager and TouchManager now use separate handlers for the Window level input events, which check to see if the canvas is the target or not, and redirect processing accordingly.
1313
* `AnimationManager.generateFrameNumbers` can now accept a start number greater than the end number, and will generate them in reverse (thanks @cruzdanilo)
14+
* The return from the `ScenePlugin.add` method has changed. Previously, it would return the ScenePlugin, but now it returns a reference to the Scene that was added to the Scene Manager, keeping it in-line with all other `add` methods in the API. Fix #4359 (thanks @BigZaphod)
1415

1516
### Bug Fixes
1617

src/scene/ScenePlugin.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,13 +434,11 @@ var ScenePlugin = new Class({
434434
* @param {boolean} autoStart - Whether to start the Scene after it's added.
435435
* @param {object} [data] - Optional data object. This will be set as Scene.settings.data and passed to `Scene.init`.
436436
*
437-
* @return {Phaser.Scenes.ScenePlugin} This ScenePlugin object.
437+
* @return {Phaser.Scene} An instance of the Scene that was added to the Scene Manager.
438438
*/
439439
add: function (key, sceneConfig, autoStart, data)
440440
{
441-
this.manager.add(key, sceneConfig, autoStart, data);
442-
443-
return this;
441+
return this.manager.add(key, sceneConfig, autoStart, data);
444442
},
445443

446444
/**

0 commit comments

Comments
 (0)