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"?
Answer by Mox
Nov 17, 2011 at 01:28 AM
Take a look at Input.GetKey and Input.GetKeyDown
Answer by jahroy
Nov 17, 2011 at 02:31 AM
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.
Like Mox says, you can also hardcode input management by using things like Input.GetKey(KeyCode.LeftControl)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
4 People are following this question.
How to make camera position relative to a specific target.
Can I make animations snap to a frame?
How to launch an animation pressing e
How to add joints to Mixamo character model downloaded from assets store?