O'Reilly logo

Unity 5.x Animation Cookbook by Maciej Szcześnik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

To use Animation Events to trigger script functions, follow these steps:

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required