phaser
phaser copied to clipboard
Drag move events triggered even after the GameObject is destroyed
Version
- Phaser Version: v3.55.2
- Operating system: Linux
- Browser: Google Chrome 109.0.5414.74
Description
Drag move event continues to be executed after the GameObject is destroyed.
Example Test Code
Minimal example: https://codepen.io/laineus/pen/zYmYXrM
This issue happens only when touch event. not happens on mouse event, so you need to try the example with device emulator of chrome devtools.
- switch to mobile emulator of devtool and reload the page
- drag the red box and move it to bottom
- the box is destroyed
- keep dragging
- errors shows up in console
properties of undefined (reading 'target')
at InputPlugin.processDragMoveEvent (phaser.js:186357:32)
at InputPlugin.update (phaser.js:185831:35)
at InputManager.updateInputPlugins (phaser.js:93090:47)
at InputManager.onTouchMove (phaser.js:93178:14)
at HTMLCanvasElement.onTouchMove (phaser.js:96211:31)
Additional Information
The error happens on this line of InputPlugin: https://github.com/photonstorm/phaser/blob/master/src/input/InputPlugin.js#L1294
Thank you.