- Home /
Animation doesn't work
Ok so this is my problem. I have object with animations: Idle, Up and Down. The Up and Down script worked perfectly before I put new animation Idle there. Now if I play it, it stays in idle (like it should), when i hit the object it plays Up animation (like it should) but when press mouse again it plays the Up animation again instead Down animation. I have no idea why. The done and play booleans work ( i checked that the boxes are ticking on/off while on play mode) but i just some how doesnt want to play the Down animation? any help?
pragma strict
var play = false; var done = false;
     function OnMouseOver () {
         if(Input.GetMouseButtonDown(0))
         {
             animation.Stop("Idle");
             play = true;
             
             }
             }
             
      function Update () {
             
           if (play == true && !done)
             {
             animation.Play("Up");
             done = true;
             
             }
             if(Input.GetMouseButtonDown(0) && !animation.IsPlaying("Up") && done) {
             animation.Play("Down");
             done = false;
             play = false;
             }
     }
Answer by whydoidoit · Apr 18, 2013 at 01:20 PM
Well you have no condition on the OnMouseOver test so that will first when you press to animate Up or Down - hence it sets play to true, hence the Up animation is played again.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                