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;
}
}