- Home /
How do I make an animation play ONCE when a key is pressed?
So I have a punch animation and I have the character punching but in order for me to do so I have to hold down the button T.T! Can you help me?
Comment
Answer by name111 · Oct 14, 2010 at 01:57 AM
var theAnimation : AnimationClip;
function OnTriggerStay () { if (Input.GetKeyDown("e")) { animation.Play(); //Other actions here if (audio) { audio.Play(); audio.loop = false; } } }
or try downloading Dastardly banana's weapons package and use their weapons system because they have a melee weapon so u can set it to play ur punch animation