Book Image

Unity Animation Essentials

By : Alan Thorn
Book Image

Unity Animation Essentials

By: Alan Thorn

Overview of this book

Table of Contents (14 chapters)
Unity Animation Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting started with Mecanim


When animations for both the button and door are created, they will play automatically in a loop every time you play the scene in the Game tab. They play automatically because upon creating an animation clip asset, Unity automatically generates an Animator Controller asset that is assigned to the animated object in the scene. The controller itself is part of the Mecanim system and uses a State Machine to define how and when an animation clip should play for an object. By default, it plays the animation clip at the beginning of the scene. The animations play on a loop because all new Animation Clip assets are specified as loopable by default. Neither the automatic playback nor the looping behavior are desired for the animation here, because the button animation should play only when the player presses the button, and the door should open only in response to the button push. Let's first disable the looping behavior of each animation clip. To do this, select each...