onStateChange : Phaser.Signal
onStateChange is a Phaser.Signal that is dispatched whenever the game changes state.
It is dispatched only when the new state is started, which isn't usually at the same time as StateManager.start
is called because state swapping is done in sync with the game loop. It is dispatched before any of the new states
methods (such as preload and create) are called, and after the previous states shutdown method has been run.
The callback you specify is sent two parameters: the string based key of the new state,
and the second parameter is the string based key of the old / previous state.
- Source code: core/StateManager.js (Line 82)
Please login to continue.