x


Animation controller

How do I define key names? eg if I am using left control to fire a weapon how do I tell Unity this? Can I just say keycode.leftcontrol = "Fire"?

more ▼

asked Nov 16, 2011 at 10:34 PM

tholland gravatar image

tholland
1 10 8 8

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Take a look at Input.GetKey and Input.GetKeyDown

more ▼

answered Nov 17, 2011 at 01:28 AM

Mox gravatar image

Mox
295 1 7

(comments are locked)
10|3000 characters needed characters left

Check out the Input Manager:

Edit -> Project Settings -> Input

After choosing this from the menu, look in the Inspector.

You'll see an item named Axes, which can be expanded and edited.

This is where all the inputs (and their behaviors) are defined.

more ▼

answered Nov 17, 2011 at 02:31 AM

jahroy gravatar image

jahroy
3.7k 36 43 73

Like Mox says, you can also hardcode input management by using things like Input.GetKey(KeyCode.LeftControl)

Nov 17, 2011 at 02:33 AM jahroy
(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:

x6518
x311
x241

asked: Nov 16, 2011 at 10:34 PM

Seen: 1824 times

Last Updated: Nov 17, 2011 at 02:33 AM