Skip to content
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

Phaser.Time.Timeline Errors on calling destroy #6844

Open
saintflow47 opened this issue Jun 24, 2024 · 2 comments
Open

Phaser.Time.Timeline Errors on calling destroy #6844

saintflow47 opened this issue Jun 24, 2024 · 2 comments
Assignees

Comments

@saintflow47
Copy link

saintflow47 commented Jun 24, 2024

Version

  • Phaser Version: 3.80.1-3.85.0-beta.1
  • Operating system: W10

Description

An issue happens on both versions when trying to destroy a timeline like this, even while it is playing. The error is different for each phaser version though.

Example Test Code

                const follower = this.scene.add.follower(curve, 0, 0, "img", "id/ranks/star");
                follower.setVisible(false)
                follower.startFollow({
                    from: pathProgress - 0.5 < 0 ? 0 : pathProgress - 0.5,
                    to: pathProgress,
                    duration: singleDuration,
                    delay: fullDuration-i*singleDuration*mp
                });
                const bloom = follower.postFX.addGlow(0xffffff,3,2)
                const timeline = this.scene.add.timeline([
                    {
                        at: fullDuration-i*singleDuration*mp,
                        run: () => follower.setVisible(true)
                    },
                    {
                        at: fullDuration-i*singleDuration*mp,
                        tween: {
                            targets: follower,
                            angle: this.getStarAngle(starCount, i)-(360*2),
                            duration: singleDuration,
                        }
                    },
                    {
                        at: fullDuration-i*singleDuration*mp+600,
                        tween: {
                            targets: bloom,
                            innerStrength: 0,
                            outerStrength: 0,
                            duration: 500,
                        }
                    }
                ]).on("complete", () => {
                    if(this?.visible){
                        follower?.destroy();
                        this?.addDivisionStarInFinalPosition(curve, pathProgress, starCount, i);
                    }
                }).play()
if(timeline?.isPlaying())  timeline.destroy();

on 3.85.0-beta.1 the error is as follows:
Uncaught ReferenceError: i is not defined
at Timeline2.clear (phaser.js:233673:14)
at Timeline2.destroy (phaser.js:233752:14)
2024_06_24_161023

on 3.80.1 the error is as follows:
TypeError: Cannot read properties of null (reading 'events')
at Timeline2.destroy (phaser.js:233464:41)
2024_06_24_164248

@zekeatchan
Copy link
Collaborator

zekeatchan commented Jun 25, 2024

Hi @saintflow47. Could you provide full source code and if possible a link to jsfiddle or codepen so we can investigate further? Thanks.

@zekeatchan zekeatchan self-assigned this Jun 25, 2024
@saintflow47
Copy link
Author

https://phaser.io/sandbox/DPz6DKZC

here is a minimal case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants