Transition Assets

A TransitionAsset is a ScriptableObject which contains a Transition.

  • You can create transition assets using the Assets/Create/Animancer/Transition Asset menu function.
  • The Library Character sample demonstrates how to use them.
Inline Transition Transition Asset
using Animancer;
using UnityEngine;

public class InlineExample : MonoBehaviour
{
    [SerializeReference] 
    private ITransition _Animation;
}
using Animancer;
using UnityEngine;

public class AssetExample : MonoBehaviour
{
    [SerializeField]
    private TransitionAsset _Animation;
}

The field is configured directly in the Inspector of the script that will use it.

If you know you want a specific Transition Type, you can use that type directly so you don't need to pick the type from the dropdown menu in the Inspector each time you use the script.

using Animancer;
using UnityEngine;

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

An asset must be created separately.

Then you can give the script a reference to it in the Inspector.

When should Transition Assets be used?

In most cases it's up you to decide whether you want each Transition to be Inline or in an Asset based on how you prefer to handle a given situation.

  • Transition Libraries require you to use Transition Assets.
  • Transition Assets are good if you want to define the details of an animation in one place for multiple characters to use. This also allows for efficient memory usage because each character can simply reference the same data instead of everyone having their own identical copy of that data.
  • Inline Transitions can often be easier to set up and maintain because you can see the transitions for a specific script directly in its Inspector and edit them without worrying about affecting any other characters.

Creating Transition Assets

If you want to quickly create Transition Assets for a group of Animation Clips, Animator Controllers, or Timeline Assets, you can select them all in the Project window and use either the Create Transition Asset function from the context menu in the top right of the Inspector or Assets/Create/Animancer/Transition Assets From Selection.

Transition Assets can also be created in code using ScriptableObject.CreateInstance<TransitionAsset>().