Book Image

Unity 2D Game Development Cookbook

By : Claudio Scolastici
Book Image

Unity 2D Game Development Cookbook

By: Claudio Scolastici

Overview of this book

<p>Unity is a powerful game development engine that provides rich functionalities to create 2D and 3D games.</p> <p>Unity 2D Game Development Cookbook is a practical guide to creating games with Unity. The book aims to serve the purpose of exploring problematic concepts in Unity for 2D game development, offering over 50 recipes that are easy to understand and to implement, thanks to the step-by-step explanations and the custom assets provided. The practical recipes provided in the book show clearly and concisely how to do things right in Unity. By the end of this book, you'll be near "experts" when dealing with Unity. You will also understand how to resolve issues and be able to comfortably offer solutions for 2D game development.</p>
Table of Contents (15 chapters)
Unity 2D Game Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Animation layers – adding a second animation layer


With the mask ready and set up, we can move back to the Animator panel to add a second animation layer. Be ready to follow our instructions.

Getting ready

We follow on from where we left off . The avatar mask is ready to be used with the second animation layer.

How to do it...

  1. With the Animator editor open in Unity, click on the small + on the widget in the top-left corner of the window to add a new layer, as shown in the following screenshot:

  2. Click on the Name field and name this layer UpperBody, the same as the mask.

  3. Set the Weight parameter to 1. This is sort of a default value; you may need to tweak it according to each of your actual animation clips.

  4. Now click on the small button in the Mask field to select Mask from the panel, among the various options available in the project. Right now, you should see the UpperBody mask we created in the previous recipe. Please refer to the following screenshot for these last three steps:

  5. The last setting...