- Home /
Namehash BLENDTREE in Substate
Hi.
I'm able to hash an animation state within a substate, but unable to do so with a blendtree in a substate. It is possible? Any tricks?.
The blendtree state is the idleState and should print Idling in the console but never does unlike the croucgState witch does work.
Here my code:
public class Player_Movement : MonoBehaviour {
public static Animator anim;
private AnimatorStateInfo stateInfo;
int crouchState = Animator.StringToHash ("Crouching.Rifle_CrouchLoop");
int idleState = Animator.StringToHash ("Standing.Idle_And_Rotate_Blend_Tree");
// Use this for initialization
void Start () {
anim = GetComponent <Animator>();
}
void Update () {
//miramos cual es el state dentro de la layer 0, la Base layer.
if (Input.GetKeyDown (KeyCode.C) )
anim.SetTrigger("IsCrouching");
stateInfo = anim.GetCurrentAnimatorStateInfo (0);
if (stateInfo.nameHash == crouchState)
Debug.Log ("crouched");
if ( stateInfo.nameHash == idleState )
anim.SetTrigger("Idling");
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity 5 - nameHash obsolete? shortNameHash vs fullPathHash 0 Answers
UnityEngine.AnimatorStateInfo.nameHash' is obsolete: "Use AnimatorStateInfo.fullPathHash instead." 0 Answers
Animator HashToString returns 0 1 Answer
How to run String To Hash at compile time? 1 Answer
How do I call string to hash on anystate animator controller 0 Answers