casey Posted January 20, 2018 Share Posted January 20, 2018 I'm trying to get the name of the current state that I am in. getCurrentState() returns a whole lot of information, including but not limited to the specific state name. How do I just return the current state (i.e. 'myCurrentState')? var myCurrentState = { preload: function () { }, create: function () { game.stage.backgroundColor = '#cce5ff'; var test = game.state.getCurrentState(); console.log(test); //logs out way too much info } }; Link to comment Share on other sites More sharing options...
in mono Posted January 20, 2018 Share Posted January 20, 2018 It's not "too much info", it's just the whole state object. If you're looking just for an identifier, try this: game.state.getCurrentState().key It will give you the key you used to add the state to the state manager. jdnichollsc 1 Link to comment Share on other sites More sharing options...
casey Posted January 20, 2018 Author Share Posted January 20, 2018 Aha! That's what I was looking for. Thank you. Link to comment Share on other sites More sharing options...
samme Posted January 20, 2018 Share Posted January 20, 2018 Phaser.StateManager#current (game.state.current) in mono 1 Link to comment Share on other sites More sharing options...
Recommended Posts