This is the old Animancer v7.4 documentation. Animancer v8.0 is now available.

Transition Assets

A Transition Asset is simply an Asset that contains a Transition. Each Transition Type also has an associated ScriptableObject type with a transition field (and nothing else) so that you can create them as assets to share a transition throughout your project instead of each object having its own individual transition. They all follow the same naming convention:

Class Type Description
ClipState State Manages the runtime details of an AnimationClip such as its Time, Speed, Events, etc.
ClipTransition Inline
Transition
A serializable class which allows the above details to be defined in the Inspector and will create a ClipState when played.
ClipTransitionAsset Transition
Asset
A ScriptableObject with a ClipTransition field.
ClipTransitionAsset
.UnShared
UnShared
Transition
Asset
A serializable class with a ClipTransitionAsset field and its own copy of the transition's ‌State and Events in order to avoid conflicts between characters who share the same asset.
  • You can create transition assets using functions in the Assets/Create/Animancer menu.
  • The Linear Blending example demonstrates how to use them.
Inline Transition Transition Asset
using Animancer;
using UnityEngine;

public class InlineExample : MonoBehaviour
{
    [SerializeField] 
    private ClipTransition _Animation;
}
using Animancer;
using UnityEngine;

public class AssetExample : MonoBehaviour
{
    [SerializeField] 
    private ClipTransitionAsset _Animation;
}
When you use a regular transition field, it is a part of the script where is it declared so every instance of that script will have its own transition details.

When you use a transition asset, you need to actually create a separate asset for your field to reference, but then anything in your project can reference that asset to use the exact same transition settings.

Normally when referencing another object like this you need to select that object to view or edit its values, but if you have Inspector Gadgets Pro it shows a foldout arrow on the Object Field so that you can show the referenced object's Inspector without changing your selection.

UnShared

After you play a transition, its ‌State property stores a reference to the Animancer State it created. More specifically, a single transition can be used to create multiple states (usually on different characters who share the same transition asset) so the ‌State property actually only references the most recently created or played state. This leads to a problem where each character wants to access their own state, but because the asset can only remember one state at a time each character needs to store their own state in another field beside their reference to the transition.

Any Animancer Events stored in the transition's Events property suffer from the same limitation. Each transition only has one AnimancerEvent.Sequence containing one list of event times and callbacks, but each character sharing the same transition will usually want to assign their own callbacks to it.

These problems can be avoided by using the UnShared class nested inside each transition asset class (e.g. ClipTransitionAsset.UnShared) instead of directly referencing the transition asset itself (e.g. ClipTransitionAsset). UnShared is a serializable class which holds a reference to the transition asset and also keeps its own reference to the ‌State and its own copy of the Events for each character.

Direct UnShared
This is what the Linear Blending example looked like before UnShared transitions were implemented. And this is what it looks like now.
using Animancer;
using UnityEngine;

public class SharedExample : MonoBehaviour
{
    [SerializeField]
    private AnimancerComponent _Animancer;

    [SerializeField] 
    private LinearMixerTransition _Mixer;

    // Store the state separately.
    private LinearMixerState _State;

    private void OnEnable()
    {
        _Animancer.Play(_Mixer);
        
        // Store the state separately.
        _State = _Mixer.Transition.State;
    }

    // Control the stored state.
    public float Speed
    {
        get => _State.Parameter;
        set => _State.Parameter = value;
    }
}
using Animancer;
using UnityEngine;

public class UnSharedExample : MonoBehaviour
{
    [SerializeField]
    private AnimancerComponent _Animancer;

    [SerializeField]
    private
LinearMixerTransitionAsset.UnShared _Mixer;

    // No additional field.

    private void OnEnable()
    {
        _Animancer.Play(_Mixer);

        // Don't store the state separately.
        //
    }

    // Just access the UnShared state.
    public float Speed
    {
        get => _Mixer.State.Parameter;
        set => _Mixer.State.Parameter = value;
    }
}

Unfortunately, changing a field's type from a transition asset class to an UnShared class will cause it to lose any existing references that were assigned to it.