Button pressing animation

I have a mostly working animation with an annoying problem. In game there is a button. When something is on the button, it should slide down, and vice versa when something is removed. Here is the script attached to the button:

`function Update () {

if (Physics.Raycast(transform.position, Vector3.up, 0.7)) {
	animation.Play("buttonPress");
}

}`

This works fine, except that when a the animation triggers, it just keeps looping. How do I just play it once, and have it stay at the final frame? (Button doesn’t pop up)

Wow. That’s sad. If a box is on the button, raycast returns true, and it just keeps playing. That was a head slapper.