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

Mecanim transitions and parameters


The problem with the push-button Mecanim graph created previously is that although it prevents any animation from playing automatically at scene startup, there's still no way to initiate the push-button animation when it's supposed to play later, that is, when the player clicks on it. The aim now is to rewire the Mecanim graph so that we have control over when the button-push animation plays, allowing playback at an arbitrary time. To achieve this we'll use transitions and parameters. Transitions are simply connections between states that allow one state to move to another. Parameters are variables, or switches, that we can create to fire a transition between two states. Let's now create a parameter that'll help us control when the Idle state (doing nothing) becomes a button-push state. Effectively, this parameter will act as a control switch for initiating animation playback. Inside the Animator window, click on the Parameters tab in the top-left corner...