GetButton will only play animation when held down

How do I play an animation completely with Input.GetButton ? It’ll only play the complete animation if the button is held down.

if (Input.GetButton ("Attack1")&& grounded==true && IsMoving==false) {
			Anim.Play("Attack1");
			IsAttacking=true;
		}

That is the snippet of code I am using for attacking. So far it works, but only if I hold down the button. I want it to play completely tho. Any help ?

You might be able to put the Anim.Play("Attack1"); in the IsAttacking variable.


If my answer helps you please accept it and up vote it! Thanks!

I fixed it using coroutine’s. My own way I guess