Error when using nested StateMachine in AnimationTree

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

I have the following AnimationTree setup (at root):

The “combat-loop” is a BlendState, which looks like this:

And, in _physics_process, I do this:

var anim_speed = velocity.length() * 0.8
var root_anim = "idle-loop"

# set the top-level animation node (idle, walk or combat)
# walk?

if character.combat_toggled:
	root_anim = "combat-loop"
elif is_moving:
	root_anim = "walk-loop"

# set it
if animRoot.get_current_node() != root_anim:
	animRoot.start(root_anim)

if root_anim == "walk-loop":
	animationTree.set("parameters/walk-loop/walk/blend_position", input_direction)
	animationTree.set("parameters/walk-loop/speed/scale", anim_speed)
elif root_anim == "combat-loop":
	var locomotion = animationTree.get("parameters/combat-loop/locomotion/playback")
	var sub_action = "walk-loop" if is_moving else "idle-loop"
	
	if locomotion.get_current_node() != sub_action:
		locomotion.travel(sub_action)

	if sub_action == "walk-loop":
		animationTree.set("parameters/combat/walk-loop/walk/blend_position", input_direction)
		animationTree.set("parameters/combat/walk-loop/speed/scale", anim_speed)

the animRoot is the StateMachine at the root of the AnimationTree.

I’m getting this error:

E 0:00:02.505   _blend_node: Condition "!p_node.is_valid()" is true. Returned: 0
<C++ Source>  scene/animation/animation_tree.cpp:185 @ _blend_node()

Does anyone have any idea what’s wrong here?

:bust_in_silhouette: Reply From: creativeape

Turns out the scene was corrupted somehow. Re-creating it fixed the issue.