- Home /
Can't Check If Animatorstate Is In Second Layer
I have a second animation layer which is only masked to the arms of the player.
Now I would like to check if the animator is in a certain state in this second layer.
function IsWeaponDrawing() : boolean {
if( myAnimatorInfo.nameHash == myAnimator.StringToHash("Arms.sheat_sword") ){
Debug.Log("sheat sword");
return true;
}else
return false;
}
But this doesn't work and I have no clue why not. "Arms" is the name of my second layer, "sheat_sword" the name of the animation state.
The "Arms" layer has blending mode set to override with a weight of 0.95.
Any clues?
Answer by 0tacun · Oct 10, 2014 at 10:11 AM
It is important to declare which layer your checking with GetCurrentAnimatorStateInfo(1). The base layer has the number 0, the second 1.
http://docs.unity3d.com/ScriptReference/Animator.GetCurrentAnimatorStateInfo.html
Your answer
Follow this Question
Related Questions
Easier way of creating transitions in the animator? 1 Answer
Animator with mask problem 0 Answers
How do I make the transition between two states in the "Animator" happen instantly? 3 Answers
How to get fileID information so i can just edit Mecanim Animator through script? 2 Answers
Animation playing backwards in a layer 0 Answers