Loading animations programatically

How is this done? I can’t seem to find any examples.

I tried the following code to load animations into my player entity:

                var animComponent = new AnimationComponent();
                animComponent.Entity = playerEntity;
                animComponent.Animations.Add("Idle", Asset.Load<AnimationClip>(@"Classes/Wizard/wizard"));
                animComponent.Animations.Add("Run", Asset.Load<AnimationClip>(@"Classes/Wizard/Run"));

                playerEntity.Add<AnimationComponent>(AnimationComponent.Key, animComponent);

However this gives me the error

Content serializer for SIliconStudio.Xenko.Rendering.Model/SiliconStudio.Xenko.Animations.AnimationClip could not be found.

So how are animationclips loaded?

I think the first asset you are trying to load, “Classes/Wizard/wizard”, is not an Animation but rather a Model.

This is why it say it can’t find a serializer/converter for the combo Model+AnimationClip (stored as Model on HDD, decoded as AnimationClip as runtime format).

I agree the message should be more explicit as to what the problem islikely be (should point user toward a mismatch between storage and runtime type), we’ll fix that!