Andromedus Posted November 1, 2018 Share Posted November 1, 2018 Hi. I have this code: this.game.scale.onSizeChange.add(this.resizeGame, this); which calls my resizeGame callback function when the game size is changed in my menu state. When I change state to my game state, the same resizeGame function in the old state is still being called. How do I cancel the callback? Thanks. :) Link to comment Share on other sites More sharing options...
dude78 Posted November 1, 2018 Share Posted November 1, 2018 this.game.scale.onSizeChange.dispose(); https://photonstorm.github.io/phaser-ce/Phaser.Game.html#scale -> https://photonstorm.github.io/phaser-ce/Phaser.ScaleManager.html#onSizeChange -> https://photonstorm.github.io/phaser-ce/Phaser.Signal.html -> https://photonstorm.github.io/phaser-ce/Phaser.Signal.html#dispose samme 1 Link to comment Share on other sites More sharing options...
Andromedus Posted November 2, 2018 Author Share Posted November 2, 2018 Thank you for that, it's exactly what I needed. I hadn't twigged it was of the type Signal and that's the part of the docs I needed to be looking in. Cheers. Link to comment Share on other sites More sharing options...
Recommended Posts