1. Create a new state layer
A) create a new layer through the 1 button
b) The layer's weight is set by the 2 property, and if 0, the state of the layer does not affect the total state machine
c) Mask is the associated node of the Avatar that sets the animation , which can be edited after the Avatar mask is created
2, edit avatar Mask: Click can change the state, if the red node is not associated with the animation
3. Gets the Hash name of the state of the specified state layer:
int reloadhashname = Animator.stringtohash("Layer2.reload");
Gets the way: status layer name . Status Name
Function: Gets the name used to determine whether the state machine's current state is a specified state when the game is updated
4. Get status information of the state machine when the game is updated
Private Animatorstateinfo Layer2stateinfo;
Layer2stateinfo = Anima. Getcurrentanimatorstateinfo (1);
Gets state information for the specified state layer through the current animation controller ,
The Getcurrentanimatorstateinfo parameter is the index of the layer, starting from 0
5. Gets the state hash name of the current state machine
Layer2stateinfo.shortnamehash
6, Case: Do a character in the walk at the same time can take the gun action DEMO
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Mecanim Animation Editor-adding animation layers for parallel actions