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

Creating scene interactions


The sample scene we're creating here finally has two animation clips (button-push and door-open), and two animation controllers that define how the clips relate to states in a scene object. In the previous sections, the controllers have been configured with triggers so that for both the door and the button, their animations can be played back on demand, simply by activating the respective trigger. Now, the problem is that the player cannot activate the triggers themselves in the game. Only we, as developers, can do that using the Unity editor during play mode. Our aim now is to have the player press the button to open the door. This means that a button push should activate both triggers in the animation controllers: one for playing the button animation, and the other for opening the door. There are many ways to achieve this interactivity. One way is through scripting, but we don't need to go that far. We can use the Unity Event System. In this section, we'll see...