- Home /
what is enter for input
hi i what to no what i would put to make the enter button work
what i mean is that when i type in Input were its say's positive Button, like what would i type to make the enter button to be activated
im sorry i cant enplane it better
You may want to edit your question to include the information you added as a comment on Ashkan's answer. People who might reply otherwise wouldn't have enough data on what you're looking for. While you're at it, edit it for clarity.
Answer by Matte Szklarz · Apr 27, 2011 at 05:06 PM
Ashkan's answer doesn't have the full details.
"enter" and "return" aren't the same button. If you're like me, working on a MacbookPro, you have a enter/return key, which was the root of my frustration for a good 20 mins.
GetKeyDown("enter") refers to the numpad's "enter" key, and will not work with my keyboard.
In order to use a MacbookPro "enter/return", you need to specify RETURN: you can do this by either :
Input.GetKeyDown("return") Input.GetKeyDown(KeyCode.Return)
It needs to be lowercase "return" btw. I couldn't type in 'Home' for example when trying to use the Home key, it had to be 'home'.
Same on the PC. "return" = Enter or $$anonymous$$eyCode.Return, "enter" = $$anonymous$$eyCode.$$anonymous$$eypadEnter, (and "[equals]" is not allowed even though the doc says it is [not that the PC has $$anonymous$$eypadEquals]). Unity could document all this better.
Answer by Ashkan_gc · Jun 21, 2010 at 06:37 AM
"return" or "enter".
if (Input.GetKeyDown("enter"))
{
//do something
}
take a look at input page in manual
documentation says
Normal keys: "a", "b", "c" ... Number keys: "1", "2", "3", ... Arrow keys: "up", "down", "left", "right" Keypad keys: "1", "[2]", "[3]", "[+]", "[equals]" Modifier keys: "right shift", "left shift", "right ctrl", "left ctrl", "right alt", "left alt", "right cmd", "left cmd" Mouse Buttons: "mouse 0", "mouse 1", "mouse 2", ... Joystick Buttons (from any joystick): "joystick button 0", "joystick button 1", "joystick button 2", ... Joystick Buttons (from a specific joystick): "joystick 0 button 0", "joystick 0 button 1", "joystick 1 button 0", ... Special keys: "backspace", "tab", "return", "escape", "space", "delete", "enter", "insert", "home", "end", "page up", "page down" Function keys: "f1", "f2", "f3", ... The names used to identify the keys are the same in the scripting interface and the Inspector.
value = Input.GetKey ("a");
that's not what i meant i meant what do i type in Input were its say's positive Button like what would i type to make the enter button to be activated
Answer by demented_hedgehog · Mar 31, 2015 at 03:07 AM
If, as it is suggested here, enter and return are different key inputs then you can use the Unity Input menu with positive button and the alt positive button (i.e. two keys for the one command) and then use the GetButton() call to determine its state. Doing this should make key customization for the user easier later on. (I believe).
Your answer
Follow this Question
Related Questions
Rigid Body Wait 1 Answer
GUI texture touch to input 1 Answer
How to alter input to continuous rather than tap? 0 Answers
Using Xbox gamepad triggers as keys instead of axis? 1 Answer