rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.22k stars 263 forks source link

BUG: Cannot run destroy on TextPlayer #465

Closed tdgao closed 3 months ago

tdgao commented 3 months ago

After creating a TextPlayer, it cannot be destroyed and removed from the scene. The following error occurs:

image

Replicated in CodePen using TextPlayer destroy example:

CodePen: https://codepen.io/Truman-Gao/pen/BagJWYp?editors=1011 Github example: https://github.com/rexrainbow/phaser3-rex-notes/blob/master/examples/textplayer/destroy.js#L1C1-L62C36

tdgao commented 3 months ago

Just a note, currently I'm just hiding all the TextPlayers on complete using setVisible(false) instead of destroy them as a temporary solution. My use case is customizing the TextPlayer on runtime which requires recreating the game object with new config. Otherwise I would have to specifically handle each customization option (That would be a pain!).

rexrainbow commented 3 months ago

Thanks for this bug reporting, this bug has been fixed. Please run that test case again. NPM package will upgrade at end of this month.

tdgao commented 3 months ago

Working now, again thanks for the quick fix!