-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
dispatchTweenEvent overwrites one of the callback's parameters #5753
Comments
What are the steps to reproduce? |
Repro steps:
Expected result: the console should display This is because the tween targets array always overwrites the callback's second argument. repro rate 3/3, the bug always appears and it's obvious why once you look at the code |
The problem is that Phaser uses Probably |
Thank you for submitting this issue. We have merged the fix for this and it has been pushed to the |
Where it says
callback.params[1] = this.targets;
in Phaser.Tweens.Tween#dispatchTweenEvent, the code overwrites your second parameter before calling the callback, which is clearly not something you want or are even warned about. This should be fixed, perhaps by appending this.targets to the start of callback.params instead of overwriting the second param. Calllbacks like these are created when calling myTween.setCallback().Also, in https://newdocs.phaser.io/docs/3.55.2/Phaser.Tweens.Tween#setCallback it says the params arrray is optional. The above code renders this documentation false, as an error is raised when the params argument is not included, because callback.params[1] returns undefined. Providing an empty params array fixes the error.
If you need more information, such as repro steps and a jsfiddle, I'll be happy to provide these.
The text was updated successfully, but these errors were encountered: