- Home /
animation.isPlaying is not working
This is my code for my script
 var check = false;
 
 function Update () {
     if(animation.isPlaying){
         check = false;
         }
     if(!animation.isPlaying){
         check = true;
         }
     }
I am using a simple technique to check if unity recognises what I want it to but it doesn't, the check box in the inspector when unity is running stays unchecked, could someone help, all I am currently stuck on is unity not recognising that there isn't any animations playing, yet it doesn't. I even tried to make both of them make the check variable true but it still doesn't work
Answer by Zentiu · Mar 02, 2014 at 04:46 PM
you need to tell wich animation is playing like:
 if(animation.IsPlaying == ("attack"))
 {
     //whatever...
 }
 
 if(animation.IsPlaying != ("attack"))
 {
     //whatever...
 }
Your answer actually doesn't work, when I use the simple check technique It will either stay checked or unchecked, I'm very confused.
im sorry it took so long to respond again.
I checked it out if it does or doesn't work and in C# it does.
this is what I used:
 Public bool check = false;
 
 void Update()
 {
 
     if(animation.IsPlaying ("run"))
     {
         check = true;
     }
     else
         check = false;
}
To be honest I don't know much about JavaScript to know how to convert this into JavaSript but this works.
By the way.. my first answer was a fail.. I wrote it out the top of my head.. sorry bout that.
Your answer
 
 
             Follow this Question
Related Questions
Animation plays without a bool, but after adding it just goes still 0 Answers
More animation optimzation - using booleans to check IsPlaying() 1 Answer
Animation stops playing after disabling and enabling game object 1 Answer
How to check if a specific animation is playing within mecanim 2 Answers
Can the animation editor create local rotational data? 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                