O'Reilly logo

Unity Animation Essentials by Alan Thorn

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

Invoking functions from animations

Frequently, you'll need to link animations with the script and game logic. Specifically, when animation playback reaches a specific frame or time, or when an animation begins or ends, you may want something else to happen in script, even on a completely different object. In the camera fly-through animation for example, we may want to show a message on the screen saying "Welcome!", when the fly-through animation ends. There are many ways to handle this type of requirement. One way is to run a function in script when a frame shows up in the animation. To create this kind of connectivity between animation and script, we'll need an animation event.

Note

The complete Unity project for an animation event is included ...

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