AnimationPlayer node malfunctioning?

Godot Version



I hooked an AnimationPlayer node to my player so I can key its Attack animation and a Collision node animation. Everything works well, and I’m calling the Attack animation like so via code: ActorController.get_child(2).play("chloe_attack").


But only the Collision is being animated, the main Animation isn’t playing. Any one knows why?

The ActorController.get_child(2) thing is because I’m using a Finite State Machine and I’ve already set my character to ActorController and I’m getting the AnimationPlayer node by saying get_child(2).

Check visuals to fully get what I’m saying:


Can you share a screenshot of the animation in AnimationPlayer? if the Collision is being animated, then it might be that the Attack animation is not being set up correctly?

Concerning the get_child(2), a more robust solution is to add a variable anim_player in chloe and set it up to $AnimationPlayer:

# in
@onready var anim_player : AnimationPlayer = $AnimationPlayer
# in"chloe_attack")

This way you won’t depend on the node ordering.

1 Like

Thanks, I will get the ActorController using the method you devised. And here’s the animation playing perfectly fine in editor:

But it’s not playing at runtime, just the Collision node animation playing at runtime.

Looks good to me! Is there any errors in the Output tab?

In your first video, it looks like that the animation starts to play the first frame and then get interrupted. Can you show us the code that is around the call to play("chloe_attack")?

Also you can add a breakpoint to the line play("chloe_attack") and then use the button Step Over (F10) in the debugger to run the code line by line from there and try to catch what could be interrupting your animation:

I honestly see no reason they the animation isn’t playing. I’ve debugged thoroughly and nothing is wrong with the code or node setup. Maybe I can delete the animation and rekey them?

Also, In this image you showed me, is the yellow arrow pointer thing pointing to what’s causing the error in your code? I’ve never really used breakpoints to debug

The red circle is where the debugger breakpoint is.
When you start the game, the debugger will stop there.
Then, if you press Step Over (F10), you will see the yellow arrow go to the next line that is run. Each time you click Step Over (F10), the yellow arrow goes one line further in what is being run.

I actually got it to work, it’s a silly mistake on my side. I forgot to key the animation name first before keying it’s frame. Here’s what I did:


Thanks for your time and suggestions.