stride3d/stride · error · InvalidOperationException

Animation 1 is not set

Error message

Animation 1 is not set

What it means

AnimationBlend.Start() checks its two required animation inputs after validating AnimationComponent. If Animation1 is null the blend tree cannot be built and the script throws InvalidOperationException at startup.

Solutions

  1. Assign an AnimationClip to the script's Animation1 property in the editor
  2. Set Animation1 in code before Start, e.g. Blend.Animation1 = myClip
  3. Verify the referenced animation asset still exists and is imported correctly

Example fix

// before
new AnimationBlend { AnimationComponent = anim, Animation2 = clip2 };
// after
new AnimationBlend { AnimationComponent = anim, Animation1 = clip1, Animation2 = clip2 };
Defensive patterns

Strategy: type-guard

Validate before calling

if (blend.Animation1 == null) blend.Animation1 = defaultClip; // assign before scene runs

Type guard

bool ReadyToBlend(AnimationBlend b) => b.AnimationComponent != null && b.Animation1 != null && b.Animation2 != null;

Try / catch

try { scene.Run(); }
catch (InvalidOperationException ex) when (ex.Message == "Animation 1 is not set") { // fix asset reference and restart
}

Prevention

When it happens

Trigger: Running a scene with the AnimationBlend script where the Animation1 property (first AnimationClip) was never assigned in the editor Property Grid or via code.

Common situations: Dropping the blend script onto an entity and assigning only one of the two clips; forgetting to reassign Animation1 after renaming/deleting an animation asset.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/7e429de3504b10f4. Report an issue: GitHub.

Appendix: source

Thrown at sources/editor/Stride.Assets.Presentation/Templates/Assets/Scripts/Animation/AnimationBlend.cs:42

    [Display("Blend Lerp")]
    public float BlendLerp = 0.5f;

    [Display("Time Scale")]
    public double TimeFactor = 1;

    private AnimationClipEvaluator anim1Evaluator;
    private AnimationClipEvaluator anim2Evaluator;
    private double currentTime = 0;

    public override void Start()
    {
        base.Start();

        if (AnimationComponent == null)
            throw new InvalidOperationException("The animation component is not set");

        if (Animation1 == null)
            throw new InvalidOperationException("Animation 1 is not set");

        if (Animation2 == null)
            throw new InvalidOperationException("Animation 2 is not set");

        AnimationComponent.BlendTreeBuilder = this;

        anim1Evaluator = AnimationComponent.Blender.CreateEvaluator(Animation1);
        anim2Evaluator = AnimationComponent.Blender.CreateEvaluator(Animation2);
    }

    public override void Cancel()
    {
        AnimationComponent.Blender.ReleaseEvaluator(anim1Evaluator);
        AnimationComponent.Blender.ReleaseEvaluator(anim2Evaluator);
    }

    public override void Update()
    {

View on GitHub (pinned to 96fad776d2)