how to change AnimationNodeAnimation by script ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By epicspaces

when generally, we click on a node in a statemachine :

can someone change this ?

animation clips at runtime ?
by script of course ? (assigning the new animation to the node)
since I have a little bit complicated architecture; I didn’t want to duplicated over and over, but just reassign animations, like it is widely used in Unity.

:bust_in_silhouette: Reply From: Yuminous

To access AnimationNodeAnimation you would use tree_root on your AnimationTree.
So for example in GDScript:

$AnimationTree.tree_root.set_animation("NameOfAnimation")`

Or in C#:

GetNode<AnimationTree>("AnimationTree").TreeRoot.SetAnimation("NameOfAnimation");`