Overview | Videos | Documentation | Demos | Integrations | API | Support

Doc Home > Items > Character Item Animations

When an item is equipped it has the option of overriding any character animations to play an item-specific animation. For example, if attacking with a sword then the character should play a sword attack animation. The item animation system will allow you to play an item animation for aiming, using, reloading, equipping, reloading, moving and idle. It is also flexible enough in that you can play a unique animation per ability. This for example lets you play a specific attack animation while crouching (using the Height Change ability). The item animation system also allows for multiple states per category which allows you to have multiple variants of an animation. The state order can be determined randomly, sequentially, or through a combo system where the states will be ordered sequentially until a timeout value in which case it'll reset back to the beginning. Due to the power of the item animation system the editor interface can look daunting at first, but you'll be adding new states in no time once you are familiar with the interface.

If you click on the GameObject for any Item you'll see a foldout for the Character Animator Options. Once this foldout is expanded you'll see six more foldouts: Default, Aim, Use, Reload, Equip, and Unequip. These six foldouts are called Item Collections. Item Collections represent the highest level of the item animation system.

Directly underneath the Item Collection folders are the Item Set foldouts. Item Sets represent the idle, moving, and ability animation states for each Item Collection.

Moving one more level lower we have the Item Group and Item State inspector. The Item Group is in red and the Item State is in green in the image above. Item Groups contain the individual states that the item animations can transition to. Item States represent the actual state that is within the Animator Controller.

If you click on an Item State within the ReordableList you'll have the options for that particular state.

One of the best ways to explain this system is give an example of a potential use case. Lets say that we have a sword and we want to play three combo attack animations. When the character is idle the animations should include the base layer, however it should not include the base layer when the character is moving. In addition, two other animations should play randomly when the Height Change ability is active.

Since these animations should play when the item is being used we are going to be adding all of these animations to the Use State collection. We are going to start by adding the animations to the Idle Set and use the first group.

We specified a State Order of combo so it'll play the Attack Left, Attack Right, and Attack Spin animations sequentially. If the player does not continue to attack within the Combo Timeout duration (1 in this example) then it'll go back to the first state, Attack Left. As an example, lets say that the player attacks at time 10. The first animation that will be played is the Attack Left animation. The player then attacks again at time 10.5 so the next animation within the combo is Attack Right. The player then waits until time 11.75 so the Attack Left animation is played again instead of Attack Spin. In order for Attack Spin to play the player would have had to attack before time 11.5.

The following settings are used for the selected state:

Name: Attack Spin

Specifies the name of the state that the animator should transition to. This name must exist within the Animator Controller

Transition Duration: 0.1

Specifies the duration of the transition to the indicated state from the previous state

Speed Multiplier: 1

Specifies the Animator Controller speed multiplier. This is only applied to the base layer

Can Replay: False

Can the same state name replay multiple times in a row? Note that this is independent of the animations looping value and is only used to determine if the Animator Controller can call the same state twice in a row

Item Name Prefix: True

Should the name of the item be appended before the state name? This is useful for when organizing the item states within substates

Layer: Base, Upper Body

Which Animator Controller layers are affected by this state? For any layers not specified the default idle animation will play

Ignore Lower Priority: True

When the Animator Controller decides on which item animation to play it will first search the high priority animations (aim, use, reload, equip, unequip), the ability animations, and finally the low priority animations (idle and movement). If Ignore Lower Priority is enabled then any layers which have a higher index than the last played state layer will ignore the low priority item animations (idle and movement). The default animation will then play (as specified within the Animator Monitor component)

With the Idle Set complete we can now setup the Movement Set.

As you can see, the Movement Set is very similar to the Idle Set except it only uses the Upper Body layer. This is done to allow free range of motion while the character is attacking. Alternatively a specific base layer animation could have been specified to go along with the moving use states but it's not necessary in this case.

The last requirement for this use case is to play two other animations when the Height Change ability is active. This can be setup very similarly as the Idle and Movement animations.

We first selected Height Change from the popup because we want a unique set of states to play when the character is crouching. Instead of a Combo State Order we specified Random so it'll randomly choose out of all of the states. The Attack Right state is setup similar to how the Movement states were setup because we only want to use the Upper Body.

You may notice that we specified a State Name of "Attack Right" versus something unique to the Height Change ability like "Crouch Attack Right". You do not need to specify "Crouch" because the Animator Monitor will automatically place all of the ability states within a substate. In order to add this state you'll need to create a new state in the "Upper Layer.Sword.Sword Crouch.Attack Right" state. The "Sword Crouch" substate is the additional substate added. We have to use "Sword Crouch" versus just "Crouch" because Unity doesn't allow duplicate nested substate names even if the duplicate names are in different parent substates.


<- Laser Sight
Item Extensions ->