The Generic ability is an extremely versatile ability that allows you to add any animation without scripting a new ability. The ability will end after a specified duration or the OnAnimatorGenericAbilityComplete event is sent.
- Decide on the animations that you want to use. For this example we are going to import the Adventure – Sample Game asset and use the PutGlassesOn animation.
- Add the animation to the Animator Controller. Create a new substate within the Full Body Layer called Generic and then create a new state that uses the PlayerPutGlassesOn motion.
- Setup the transitions to your new state. By default the Generic ability uses an AbilityIndex of 10000 so it doesn’t get in the way of other abilities. For this example we are going to use an AbilityIndex value of 10100.
- Select the + button in the ability list under the “Abilities” foldout of the Ultimate Character Locomotion component.
- Add the Generic ability.
- Set the AbilityIndex value to the same value that was set for the transition. This value should be set to 10100 in this example.
- Decide if the ability should end based upon an animation event or a timer. An animation event is more accurate so we will use this method.
- Decide when the ability should play. By default the ability will start when the action button is pressed.
Specifies if the ability should stop when the OnAnimatorGenericAbilityComplete event is received or wait the specified amount of time before ending the ability.