complete animation

hi all
i use c# script and want when left mouse button clicked then my attack animation perform.
i write this but i must hold down button till its animation complete.
how can i play animation with one click button?
thankful.

Can you post your code?

If you are playing another animation automatically after releasing left key (i.e. idle). Make sure you use PlayQueued() function to go back to idle instead of Play(). This will make idle animation wait until current animation completes.

thankful.
i write myAnimation.Stop();
then correct;

but why when i use yield return WaitForSeconds(1f);
it write unknown identifier?
how can use wait for seconds in c#?

very thankful.

In the last case, is “yield return NEW WaitForSeconds(1f)”.

very thankful.