O'Reilly logo

Unity 2D Game Development Cookbook by Claudio Scolastici

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

Animation layers – creating masks

With Mecanim, it is also possible to blend animations for different body parts of a character. Let's see an example. You have a character that runs with a gun in its hand and you have a reload animation that the character performs each time its weapon is empty. When the character reloads, you want his upper body, actually its arms, to perform the reload action, while the lower body of the character, its legs, should keep running.

To achieve that in Unity, Mecanim features what are known as layers. Layers allow you to create masks for specific body parts of a character and apply animation clips only on those parts. A running animation that involves legs and arms can be blended with a reload animation that only involves ...

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