0 votes

How do I change an animation in AnimationTree to another using a script?
enter image description here

enter image description here

enter image description here
extends AnimationTree

func _ready():

Godot version 4
in Engine by (27 points)
edited by

1 Answer

+1 vote
set("parameters/state_machine_name/state_name/blend_2/blend_amount",  0.5)

You can see parameter names by hovering over them in the editor (e.g. Blend Amount); you can copy them by right-clicking a parameter and using the context menu.

by (1,102 points)

I asked how to change animation. AnimationNodeAnimation

enter image description here

Blend2 and other nodes are available in Parameters, but AnimationNode is not there.

enter image description here

Not sure why you’d change the animation here; perhaps you mean to use a state machine instead of a blend? The node itself is output only I believe, with just one property of ‘animation’ (which does have a setter).


Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.