Skip to content

Commit 605ea31

Browse files
committed
SceneManager.start will now reset the SceneSystems.sceneUpdate reference to NOOP. This gets set back to the Scene update method again during bootScene (if it has one) and stops errors with external plugins and multi-part files that may trigger update before create has been called. Fix phaserjs#4629
1 parent 165c908 commit 605ea31

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/scene/SceneManager.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var Systems = require('./Systems');
2020
*
2121
* The Scene Manager is a Game level system, responsible for creating, processing and updating all of the
2222
* Scenes in a Game instance.
23-
*
23+
ó *
2424
*
2525
* @class SceneManager
2626
* @memberof Phaser.Scenes
@@ -1156,33 +1156,39 @@ var SceneManager = new Class({
11561156

11571157
if (scene)
11581158
{
1159+
var sys = scene.sys;
1160+
11591161
// If the Scene is already running (perhaps they called start from a launched sub-Scene?)
11601162
// then we close it down before starting it again.
1161-
if (scene.sys.isActive() || scene.sys.isPaused())
1163+
if (sys.isActive() || sys.isPaused())
11621164
{
1163-
scene.sys.shutdown();
1165+
sys.shutdown();
11641166

1165-
scene.sys.start(data);
1167+
sys.sceneUpdate = NOOP;
1168+
1169+
sys.start(data);
11661170
}
11671171
else
11681172
{
1169-
scene.sys.start(data);
1173+
sys.sceneUpdate = NOOP;
1174+
1175+
sys.start(data);
11701176

11711177
var loader;
11721178

1173-
if (scene.sys.load)
1179+
if (sys.load)
11741180
{
1175-
loader = scene.sys.load;
1181+
loader = sys.load;
11761182
}
11771183

11781184
// Files payload?
1179-
if (loader && scene.sys.settings.hasOwnProperty('pack'))
1185+
if (loader && sys.settings.hasOwnProperty('pack'))
11801186
{
11811187
loader.reset();
11821188

1183-
if (loader.addPack({ payload: scene.sys.settings.pack }))
1189+
if (loader.addPack({ payload: sys.settings.pack }))
11841190
{
1185-
scene.sys.settings.status = CONST.LOADING;
1191+
sys.settings.status = CONST.LOADING;
11861192

11871193
loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this);
11881194

0 commit comments

Comments
 (0)