From e728f3a1b954482b7498c0f82ff0a8c56608a3a3 Mon Sep 17 00:00:00 2001 From: pixelhijack Date: Thu, 29 Mar 2018 21:40:32 +0200 Subject: [PATCH] [ISSUE #3363] Phaser Scene - passing data to scene init & create methods --- src/scene/SceneManager.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/scene/SceneManager.js b/src/scene/SceneManager.js index e6feb53df..26ed970ec 100644 --- a/src/scene/SceneManager.js +++ b/src/scene/SceneManager.js @@ -180,7 +180,7 @@ var SceneManager = new Class({ { entry = this._start[i]; - this.start(entry); + this.start(entry, entry.scene.data); } this._start.length = 0; @@ -219,7 +219,7 @@ var SceneManager = new Class({ { entry = this._start[i]; - this.start(entry); + this.start(entry, entry.scene.data); } // Clear the pending lists @@ -309,7 +309,7 @@ var SceneManager = new Class({ { if (this.game.isBooted) { - this.start(key); + this.start(key, newScene.sys.settings.data); } else { @@ -695,6 +695,11 @@ var SceneManager = new Class({ } } + if (sceneConfig.hasOwnProperty('data')) + { + newScene.data = sceneConfig.data; + } + return newScene; }, @@ -951,7 +956,7 @@ var SceneManager = new Class({ if (entry.key === key) { entry.autoStart = true; - entry.data = data; + entry.scene.data = data; } }