Creating Custom States

Pro-Only: Animancer Lite allows you to try out this feature in the Unity Editor, but it will not be available in runtime builds unless you purchase Animancer Pro.

You can implement your own state type by inheriting from AnimancerState (or any type derived from it):

using Animancer;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;
 
public sealed class MyState : AnimancerState
{
    private AnimationClip _Clip;

    public override float Length => _Clip.length;

    public MyState(AnimationClip clip)
    {
        _Clip = clip;
    }

    protected override void CreatePlayable(out Playable playable)
    {
        playable = AnimationClipPlayable.Create(Root.Graph, _Clip);
    }
}