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

When an animation player is paused by a method call, resuming the animation causes the method call to run repeatedly #87041

Closed
redheaddj opened this issue Jan 10, 2024 · 1 comment

Comments

@redheaddj
Copy link

Tested versions

  • Reproducible in v4.2.1.stable.mono.official [b09f793], v4.2.1.stable.official [b09f793]
  • Not reproducible in v4.1.2.stable.mono.official [399c9dc]

System information

Godot v4.2.1.stable.mono - Windows 10.0.22621 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.3742) - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

Issue description

If you call a function from an animation player using a call method track and that function pauses the current animation, resuming the animation using animationPlayer.play() will cause that method to be called again. This will cause the animation to repeatedly call the method over and over again and the animation will not continue.

The intended behaviour (this was how it worked in 4.1.2) is that when the animation is resumed, the method will not be called again and the animation will continue as normal.

One workaround for this issue is to instead set speed_scale to 0 when you want to pause the animation and to set it back to 1 when you want to resume it.

Steps to reproduce

  1. Create a new scene
  2. Add an animation player and a timer as children of the root node
  3. Add a new script to the root node
  4. Create a method that pauses the animation player and starts the timer
  5. Take the timeout() signal from the timer, connect it to the root node, and in that method, play the animation
  6. Make a new animation in the animation player and set it to run on start
  7. Add a Call Method Track to the animation and call the method in the root node somewhere in the animation
  8. Run the game and it should cause the method you made to run repeatedly

This is an example of the code that could be written in the root node
godotissue

This is an example of the animation that could be made to reproduce the issue
godotissue2

Minimal reproduction project (MRP)

AnimationPlayerMethodCallRepeatIssue.zip

@AThousandShips
Copy link
Member

AThousandShips commented Jan 10, 2024

Thank you for reporting, closing as a duplicate of:

This has been fixed and will be available in a future 4.2 release, as well as in 4.3

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants