Restore animation position on AnimationTree

Godot Version

4.6.1

Question

I have a AnimationTree with a Animation Statemachine, this all works. In code i can grab my StateMachinePlayback and can get the current animation node and position:

var AnimationPlayback : AnimationNodeStateMachinePlayback
AnimationPlayback = $AnimationTree.get("parameters/playback")

var SavedAnimation : StringName = AnimationPlayback.get_current_node()
var SavedPosition : float = AnimationPlayback.get_current_play_position()

However.. how do i restore said play position? I tried with AnimationTrees “Advance” but that doesn’t work, the animation always starts from the beginning.

AnimationPlayback.start(SavedAnimation)
$AnimationTree.advance(SavedPosition)

I also tried “seek” on the player, but that doesn’t work either.

Any ideas?

It’s not possible to seek within a state machine node. You’ll need to use a blend tree with the animation and a timeseek node as the state node.