Mouse Click Animation

I have a character, you can say it’s an inspector… My Question is how do I animate the guy when I click with the mouse button. I did try in javascript

function OnMouseOver () {
if (Input.GetMouseButtonDown(0)) {
animation.Play(“CHECK”);
}
}

but my problem is that it only plays when i have the mouse button down, when I release it, its stops. I want my whole animation to play and not just a part of it.

Please help me out…

I’m not too experienced with coding, but it might be because you’ve only put it on ‘GetMouseButtonDown’.

I have not used animation much and this is a bit of work around, but you could use something like:

function OnMouseOver () 
{ 
if (Input.GetMouseButtonDown(0)) 
  { 
     play=true;
  } 
}

function Update ()
{
if (play == true)
  {
     animation.Play("CHECK");
  }
}

Have you tried “Input.GetMouseButtonUp”?