To use Animation Events to trigger script functions, follow these steps:
- Import your character with the HumanAttack animation to Unity.
- Go to the Animation import settings tab in the Inspector window.
- Select the HumanAttack animation.
- Navigate down to the Events section and unfold it.
- Use the Preview window to scrub through the animation to the moment of the hit in the attack.
- Add an Animation Event by pressing the Add Event button, as shown in the following screenshot:
Adding Animation Events
- The Edit Animation Event window will appear. Type Attack in the Function text field. To make the event work, we need to have a ...