Using Animation Events to throw an object
Now that your animated character is ready, you might want to coordinate some of her actions with her animation states. In this recipe, we will show this by making the character throw an object whenever the appropriate animation clip reaches a particular tie point in the animation. To do so, we will make use of Animation Events, which basically trigger a function from the animation clip's timeline. This feature, introduced in the Mecanism system, should feel familiar to those experienced with the Add Event feature of the classic Animation panel:

Getting ready
For this recipe, we have prepared a Unity Package named Throwing, containing a basic scene that features an animated character and a prefab named EasterEgg. The files can be found in the 09_07
folder.
How to do it...
To make an animated character throw an object, follow these steps:
- Create a new 3D project and import the Props Unity Package and the
EasterEgg
Texture. - Open the
mecanimPlayground
level...