You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phaser Version: Phaser v3.16.2 (WebGL | Web Audio)
Operating system: Ubuntu 18.04.2 LTS
Browser: Google Chrome 73.0.3683.103 (Official Build) (64-bit)
OS and Browser should not be relevant to this issue.
Description
If a game object gets destroyed in a touch event(In my case a GAMEOBJECT_POINTER_UP caused by touching) the InputPlugin throws the following error:
InputPlugin.js:1497 Uncaught TypeError: Cannot read property 'localX' of undefined
at InputPlugin.processUpEvents (InputPlugin.js:1497)
at InputPlugin.update (InputPlugin.js:620)
at InputManager.updateInputPlugins (InputManager.js:990)
at InputManager.queueTouchEnd (InputManager.js:1111)
at HTMLCanvasElement.onTouchEnd (TouchManager.js:226)
This is due to the plugin emitting the GAMEOBJECT_POINTER_UP and then immediately trying to emit the GAMEOBJECT_POINTER_OUT event a few lines later without checking if the game object still exists.
I'd be willing to fix this myself in a PR, but wanted to make sure that I am using this API correctly. Are we allowed to destroy game objects directly in event handlers or MUST they be destroyed at the event of update calls? (I've had a few other issues with destroying game objects throwing errors in phaser internals, but was about to work around them in the past)
The text was updated successfully, but these errors were encountered:
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.
Version
OS and Browser should not be relevant to this issue.
Description
If a game object gets destroyed in a touch event(In my case a
GAMEOBJECT_POINTER_UP
caused by touching) the InputPlugin throws the following error:This is due to the plugin emitting the
GAMEOBJECT_POINTER_UP
and then immediately trying to emit theGAMEOBJECT_POINTER_OUT
event a few lines later without checking if the game object still exists.https://github.com/photonstorm/phaser/blob/0db663d901b89f4ffdfff53458dbaf2818ff8dab/src/input/InputPlugin.js#L1490-L1498
Example Test Code
Additional Information
I'd be willing to fix this myself in a PR, but wanted to make sure that I am using this API correctly. Are we allowed to destroy game objects directly in event handlers or MUST they be destroyed at the event of update calls? (I've had a few other issues with destroying game objects throwing errors in phaser internals, but was about to work around them in the past)
The text was updated successfully, but these errors were encountered: