how do i stop an animation looping?

I want to make a first person game where you swing a sword. I’ve made the animation for the sword swinging but when I press play it automatically starts looping. this is my code:

'#pragma strict

function Update ()

How can I make it so that it only loops when I hold down left click?

P.S. sorry, i’m kinda a noob to unity.

Find the animation (Attack_001) in the Assets (Project) folder. Unloop it there.

Depending on how it was made, uncheck the Loop box, or switch WrapMode to PlayOnce (it should be obvious, once you’re there.) Check Apply when done (but it will usually ask anyway.)

A funny thing about animations is they are “smart,” and won’t restart playing if they already are. So you can safely use animation.Play every frame (or CrossFade, which avoids little jumps) to get a “loop while held down.”

Open the animation file in your assets folder, and disable ‘Loop time’