- Home /
 
              This question was 
             closed Jun 30, 2013 at 05:09 PM by 
             Griffo for the following reason: 
             
 
            Solved
 
               Question by 
               Griffo · Jun 30, 2013 at 04:57 PM · 
                animationmecanimstate-machine  
              
 
              Mecanim : reference state machine animation
I'm trying to reference a animation in a state machine called Motion on the base layer this is what I have -
 private var anim : Animator;
 private var Layer00CurrentState : AnimatorStateInfo;
 private var runState = Animator.StringToHash("Base Layer.Run");
 
 function Start(){
 
 anim = GetComponent.<Animator>();
 }
 
 function Update(){
 
     Layer00CurrentState = anim.GetCurrentAnimatorStateInfo(0);
 
     if (Layer00CurrentState.nameHash == runState){
          print("Do Stuff Here");
     }
 }
 
               But when the model runs it does not print out, I've also tried -
 private var runState = Animator.StringToHash("Motion.Run");
 
               Any ideas please ?
               Comment
              
 
               
              Never $$anonymous$$d I've done it it was -
 private var runState = Animator.StringToHash("$$anonymous$$otion.Run");
 
                  But I had the animation set as loop, set it not to loop and it prints out now.