Hey! Adding a scene to the game and then trying to get the scene immediately returns undefined.
game.scene.add('Dialogue', Dialogue);
game.scene.getScene('Dialogue');
// Returns undefined
If we could have a function that is called after the scene is done being added that would be nice.
Did you make sure the game is entirely booted at the time of the check?
Here is an example of the method you could use:
var game = new Phaser.Game({
callbacks: {
postBoot: function(game) {
var upAndRunningScene = game.scene.getScene('Dialogue');
//Should be OK here!
}
}
});
game.scene.add(
'Dialogue',
Dialogue,
true
);
Oh my gosh I didn't know about that callback config. Thank you!
Most helpful comment
Did you make sure the game is entirely booted at the time of the check?
Here is an example of the method you could use: