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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.