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.startis called because state swapping is done in sync with the game loop. It is dispatched before any of the new statesmethods (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: