stride3d/stride · error · InvalidOperationException
The animation component is not set
Error message
The animation component is not set
What it means
AnimationBlend (a generated script template) validates its required properties in Start(). If the AnimationComponent reference is null — nothing was assigned in the editor or via code — the script cannot build its blend tree and throws InvalidOperationException.
Solutions
- Add an AnimationComponent to the entity and assign it to the script's AnimationComponent property in the editor
- Assign AnimationComponent in code before the script starts (e.g. in the entity's initialization)
- Verify the script is attached to an entity with an AnimationComponent, not a bare entity
Example fix
// before
entity.Add(new AnimationBlend()); // AnimationComponent never set
// after
var anim = entity.Get<AnimationComponent>();
entity.Add(new AnimationBlend { AnimationComponent = anim, Animation1 = clip1, Animation2 = clip2 }); Defensive patterns
Strategy: type-guard
Validate before calling
var anim = entity.Get<AnimationComponent>();
if (anim == null) throw new InvalidOperationException("Entity requires an AnimationComponent"); Type guard
AnimationComponent ResolveAnim(Entity e) => e.Get<AnimationComponent>() ?? e.GetOrCreate<AnimationComponent>();
Try / catch
try { script.Start(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("animation component")) { // log setup error and disable script
} Prevention
- Fill all [DataMember] script properties in the Property Grid before saving the scene
- Validate required script properties in a scene-start checklist or editor validator
- Avoid copying scripts between entities without re-linking component references
When it happens
Trigger: Attaching the AnimationBlend script to an entity without assigning its AnimationComponent property (in the Property Grid or in code) before the scene runs.
Common situations: Adding the blend script to an entity that has no AnimationComponent at all; forgetting to wire the property after copying the script to another entity.
Related errors
- Animation 1 is not set
- Animation 2 is not set
- Custom strides is not supported with packed PixelFormats
- A region can only be specified for Textures with…
- A texture with size [ ] already exist with the same output…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/2614f5d7bcc2cc8a.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/Templates/Assets/Scripts/Animation/AnimationBlend.cs:39
public AnimationClip Animation2;
[DataMemberRange(0, 1, 0.01, 0.1, 3)]
[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);
}View on GitHub (pinned to 96fad776d2)