AnimationPlayer - pause() and play() - why doesn’t it work?

Godot Version

<4.2.2->

Question

< I have a simple animation that stops at a certain point: for the AnimationPlayer node, I created a Call Method Track and added an InsertKey - pause(). The animation stops at this point.

Then, I would like the animation to resume playing from that place after clicking the appropriate button. I created a button, connected the pressed signal, and added the AnimationPlayer.play() function.

func _on_button_pressed():
    $AnimationPlayer.play("new_animation")

Unfortunately, after clicking the button, the animation does not resume. What’s wrong?->

I can do $animation_player.stop(false) to pause the animation. The false here is actually a reset parameter, as shown in the built-in docs. You then could resume it via $animation_player.play()

Thank’s for the information, but that’s not what I meant. animation_player.stop() - stops the animation and resets it to the beginning, pause() - pauses the animation. That’s an important difference.

In the GODOT documentation, there are imprecise pieces of information:

pause() - Pauses the currently playing animation. The current_animation_position will be kept, and calling play or play_backwards without arguments or with the same animation name.

play() - It does not affect resuming playback that was paused in the middle of an animation.

so…

can you try it with out argument

func _on_button_pressed():
    $AnimationPlayer.play()
1 Like

I found a solution. I updated GODOT to the current version 4.2.2 and it works