Problem with "function OnMouseDown"

Hi!
I’ve problem with the function mouse.
I Did this script, and I put it into GameObject that has Mesh Collider, and Animation.
But if I click on the GameObject, the animation dont start.
If I change the script whit button Input, It work… es: (ifInputGetKey(click a taste))
The problem is this script, or maybe some setting…

Image: http://oi41.tinypic.com/24etijs.jpg

Script:

#pragma strict



var AnimCancelloIngresso : String;

function OnMouseDown ()
{
    if (Input.GetMouseButtonDown(0))
    {
        animation[AnimCancelloIngresso].speed = 1.0f;
        animation.Play(AnimCancelloIngresso);
        audio.Play();
    }
}

thanks for the help ! :wink:

Remove the Input.GetMouseButtonDown(0) if statement. That is used for in Update or checking to see if the mouse is actually down. The OnMouseDown function gets triggered when the object is clicked.

function OnMouseDown ()
{
    //if (Input.GetMouseButtonDown(0))
    //{
    animation[AnimCancelloIngresso].speed = 1.0f;
    animation.Play(AnimCancelloIngresso);
    audio.Play();
    //}
}