Hi all,
I have been investigating a weird bug. I have managed to fix it in a “hacky” way, which makes me think that it is a possible bug with Phaser 3.
When clicking on fullscreen, the game enters and then quickly exits fullscreen.
Setup: We have 2 Phaser Game instances - one for the preloader (due to separation of concerns, multiple preloader options etc.). When the first one is created the following code is executed from Phaser (line 72432 in phaser.js)
listeners.fullScreenChange = function (event)
{
return _this.onFullScreenChange(event);
};
This also happens when we actually create the game. The problem is that:
game.destroy(true) // or game.destroy(true,true);
does not unsubscribe from this (and possibly other) signal (s). This is why the event was called twice.
FIX: We fixed it by calling:
game.scale.stopListeners();
right before destroying the game.
My questions are:
- Is this really a bug, or is there a better way to completely destroy a Phaser Game Instance?
- Shall I create a bug on github?
- Is there anything else that is not destroyed when destroying a Phaser Game Instance?
Thanks!