Animation in unity

Can i animate an object in unity and have that animation played when triggered by a trigger. Also do animations have to repeat or can they just play through the animation once.

If you have a reference to the Animator component in your script, you can trigger animations using the SetTrigger, SetBool, SetInt, or SetFloat methods. If you are checking for an OnTriggerEnter from another object, you can always send a message to the collider.gameObject to fire some kind of reaction, which can include your Animator triggers.

As for looping, I tend to have a second state which is an idle state which the Animator will revert to at the end of an animation that should be played once. The single loop animation has a transition to the Idle state with a condition of exit time = 1.00.

void OnTriggerEnter(Collider other)