x


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?

more ▼

asked Oct 13 '10 at 11:15 PM

Nolan Encarnacion gravatar image

Nolan Encarnacion
39 7 7 13

Can you post your code..?

Oct 13 '10 at 11:20 PM Marowi
(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest
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

more ▼

answered Oct 14 '10 at 01:57 AM

name111 gravatar image

name111
161 5 6 15

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3776
x786
x491
x138
x11

asked: Oct 13 '10 at 11:15 PM

Seen: 1588 times

Last Updated: Oct 13 '10 at 11:15 PM