Changing the animation of an AnimationNode inside of the AnimationTree (C#)

Godot Version

v4.2.1.stable.mono.official [b09f793f5]


I have an “Attack” animation node in my animation tree, and I want to change its animation for different types of attacks, so that whenever I use animationNodeStateMachinePlayback.Travel(“Attack”) I get the correct animation.

I found a post for gdscript that says to use this:

animation_tree.get_tree_root().get_node("custom_anim_1").animation = "some_animation"

But I have no idea ho to translate it to C#

Solved it:

        AnimationNodeStateMachine animTreeRoot = (AnimationNodeStateMachine);
        AnimationNodeAnimation animNode = (AnimationNodeAnimation)animTreeRoot.GetNode("Ability");
        animNode.Animation = (User.animLibrary+"/Jump");

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.