Animate Button/Object When Clicked In Game

function OnMouseUp() {
animation.Play(“elevatorButtonPress.anim”);
}

This is my first script in Unity.
I have the above javascript.

The idea is for it to play the button animation when I click the object, but it doesn’t do anything at all when i mouse click it in game mode.

The animation plays just fine in the animation window… makes the button push in and back out.

I’m not sure what i’m doing wrong (or even right)

Remove “.anim” from Play method parameter, like below:

    function OnMouseUp() {
        animation.Play("elevatorButtonPress");
    }

First as “appearance” said… drop the “.anim” suffix

ALSO

needed to add a collider to the box so it could be triggered, but it does NOT need to have the “Is Trigger” option checked… just a collider.

Thank you appearance