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

AnimationPlayer Call Method executes twice #61431

Closed
Jegber opened this issue May 26, 2022 · 4 comments
Closed

AnimationPlayer Call Method executes twice #61431

Jegber opened this issue May 26, 2022 · 4 comments

Comments

@Jegber
Copy link

Jegber commented May 26, 2022

Godot version

3.4.4.stable.official [419e713]

System information

MacOS 12.3.1, also tested in Windows 10

Issue description

AnimationPlayer Call Method is executed twice when the key is placed at the very end of the animation.

Steps to reproduce

  1. Create a Scene with an AnimationPlayer as a child of the main node
  2. Create a new animation
  3. Add a Call Method Track
  4. At the very end of the of the track, place a key referencing a function in the parent node's script

When the animation is triggered, the function referenced by the key will execute twice.

Minimal reproduction project

https://github.com/Jegber/godot-animationplayer-bug (bugsquad edit: fixed the link)
(Github won't let me upload a .zip for some reason. This repository is a project which replicates the bug.)

To see the bug in this project, simply Play either the World scene or the Player scene. Press Space to swing your sword. The key called at the end of the Player's attack animation will be executed twice.

This bug has apparently been around for a while now: https://godotengine.org/qa/74053/why-is-my-animationplayer-calling-this-method-twice

@Jegber Jegber changed the title AnimationPlayer Call Method executed twice AnimationPlayer Call Method executes twice May 26, 2022
@Trudzen
Copy link

Trudzen commented May 26, 2022

This bug seems also to exist in Godot 4 if the AnimationPlayer is part on an AnimationTree and you call the animation over AnimationNodeStateMachinePlayback.start(...) more than one time. First method call happens directly after the animation started and at the end of the animation as it should be.

@kleonc
Copy link
Member

kleonc commented May 26, 2022

Present in 3.5.beta1, seems fixed since 3.5.beta2 (most likely fixed by #54827).
cc @timothyqiu

@timothyqiu
Copy link
Member

Yeah, if I comment out the state change in the method, it's the same endless loop as in #50636.

@Jegber you can try the recent 3.5.rc2.

@Jegber
Copy link
Author

Jegber commented May 26, 2022

Verified bug no longer appears in 3.5.rc2. Thanks all!

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

5 participants