New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destroy interactive on mobile lead to Uncaught TypeError on other sprite events. #4228
Comments
I found source of the problem. const sprite1 = this.add.image(150, 150, 'Character Pink Girl');
sprite1.setInteractive({
pixelPerfect: true,
draggable: true,
});
const handler = () => {
sprite1.off('pointerdown', handler); // here !
sprite1.destroy();
};
sprite1.on('pointerdown', handler); I don't know if it is even a bug or my misunderstanding :-) |
i get the same error when i destroy my image inside of the dragenter event
how can i fixe that |
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
Many thanks @photonstorm. I Put to test it as an entry in my backlog. Therefor it will be done soon :-) |
I've just tested on v3.16.2 and it works perfectly. Many thanks again. |
Version
Phaser Version: 3.15.1
Operating system: android
Browser: chrome
Description
On mobile device, when a draggable interactive image is destroyed, the 'pointerdown' event on other 'draggable' sprite lead to 'Uncaught Type Error' exception.
Here is the example to illustrate:
On Desktop, everything is fine. We can click on both images and both are deleted properly.
On my Android phone, the first one works well but the second one does not works.
It generate the following LogCat log:
After some investigation, it appears that problem come from the fact to destroy the image into the event.
When doing this:
it works well.
Thanks
Big thank to Phaser team 👍
The text was updated successfully, but these errors were encountered: