template-react icon indicating copy to clipboard operation
template-react copied to clipboard

Plugins getting destroyed on game create and hot reload

Open KlutzyBubbles opened this issue 6 months ago • 5 comments

I have been trying to use a plugin with this template but it just gets destroyed, minimal example can be found at https://github.com/KlutzyBubbles/phaser-react-plugin

However is only gets destroyed when a browser refresh or hot reload of phaser related files happens, but works fine when react files are hot reloaded.

Below is an image where 1 is a browser refresh, 2 is a hot reload from a react file and 3 is a hot reload from a scene file.

Image

The only spot i can see the game being destroyed which could trigger the plugin destroying is https://github.com/phaserjs/template-react/blob/db8c134eb6328ba5d08eb4ef77270f38e2e0b9b9/src/game/PhaserGame.jsx#L11C4-L32C15 but i don't know what to do to fix it. Any help or pointers would be greatly appreciated.

This can also be replicated in the typescript version of this template

KlutzyBubbles avatar Apr 16 '25 00:04 KlutzyBubbles