A TransitionAsset
is a ScriptableObject
which contains a Transition.
- You can create transition assets using the
Assets/Create/Animancer/Transition Asset
menu function.- Or if you're using a Transition Library, you can create
TransitionAsset
s inside the library itself.
- Or if you're using a Transition Library, you can create
- The Library Character sample demonstrates how to use them.
Inline Transition | Transition Asset |
---|---|
|
|
The field is configured directly in the Inspector of the script that will use it. | An asset must be created separately, then you can give the script a reference to it in the Inspector. |
Multiple instances of a character will each have their own copy of the transition details which is usually a waste of memory. | Multiple instances of a character will all reference the same asset so any modifications will apply to everything that uses it. |
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 to show the referenced object's Inspector without changing your selection. |
- Transition Assets can also be created in code using
ScriptableObject.CreateInstance<TransitionAsset>()
.
When should Transition Assets be used?
In most cases it's up to the user to decide whether to use Transition Assets or Inline Transitions 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.