How to reload the game on Phaser 3?

Viewed 6338

How to restart the game when you click on the button? I tried the following code:

this.scene.stop();
this.scene.start();

The scene reloads, but the preload function does not work again.

1 Answers

Try this code:

this.registry.destroy(); // destroy registry
this.events.off(); // disable all active events
this.scene.restart(); // restart current scene

Also have a look at the Phaser 3 Documentation for more info

Related