When I try to call phaserGame.destroy(true) on my game, I get the following JS error:
Uncaught TypeError: Cannot read property 'update' of null
at MatterPhysics.shutdown (MatterPhysics.js?4380:309)
at MatterPhysics.destroy (MatterPhysics.js?4380:330)
at EventEmitter.emit (index.js?ba10:202)
at Systems.destroy (Systems.js?9339:747)
at SceneManager.destroy (SceneManager.js?cec0:1607)
at Game.runDestroy (Game.js?22d5:673)
at Game.step (Game.js?22d5:460)
at TimeStep.step (TimeStep.js?fdd3:550)
at step (RequestAnimationFrame.js?7d37:105)
Looking at the line number in MatterPhysics.js, it looks like this.world is already null.
eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world);
I had found this old topic of how to destroy a Phaser 3 game: http://www.html5gamedevs.com/topic/32563-whats-the-proper-way-to-destroy-a-phaser-3-game-instance/
Using “Phaser v3.17.0-FB (WebGL | Web Audio)”