Search Unity

Get current state of blend tree ?

Discussion in 'Animation' started by Griffo, Mar 18, 2015.

  1. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi,

    Ok I can check to see if a animation is playing in a sub state machine like below.

    Code (JavaScript):
    1. private var idleState = Animator.StringToHash("Locomotion.Idle");  
    2. function Start (){
    3.      _anim = GetComponent.<Animator>();                    
    4. }
    5. function Update ()
    6. {
    7.      currentBaseState = _anim.GetCurrentAnimatorStateInfo(0);
    8.      if (currentBaseState.nameHash == idleState){
    9.           // Do Stuff
    10.      }
    11. }
    But I can't seem to check a blend tree like below, anyone know how to check a blend tree state?

    Thanks.
     

    Attached Files: