Enum Key
Enumeration of key codes.
Namespace: UnityEngine.InputSystem
Syntax
public enum Key
Remarks
Named according to the US keyboard layout which is used as a reference layout. Note, however, that keys are identified by physical location, not by the characters they generate. This means, for example, that A is always the key to the right of CapsLock, regardless of which key (if any) produces the "a" character on the current keyboard layout.
To find the text character (if any) generated by a key according to the currently active keyboard layout, use the displayName property of KeyControl.
// Look up key by key code.
var aKey = Keyboard.current[Key.A];
// Find out which text is produced by the key.
Debug.Log($"The '{aKey.keyCode}' key produces '{aKey.displayName}' as text input");
Fields
Name | Description | Value |
---|---|---|
None | Invalid key. Does not represent a key on the keyboard and is only used to have a default for the Key enumeration not represent any specific key. |
0 |
Space | The spaceKey. |
1 |
Enter | The enterKey. |
2 |
Tab | The tabKey. |
3 |
Backquote | The backquoteKey. |
4 |
Quote | The quoteKey. |
5 |
Semicolon | The semicolonKey. |
6 |
Comma | The commaKey. |
7 |
Period | The periodKey. |
8 |
Slash | The slashKey. |
9 |
Backslash | The backslashKey. |
10 |
LeftBracket | The leftBracketKey. |
11 |
RightBracket | The rightBracketKey. |
12 |
Minus | The minusKey. |
13 |
Equals | The equalsKey. |
14 |
A | The aKey. |
15 |
B | The bKey. |
16 |
C | The cKey. |
17 |
D | The dKey. |
18 |
E | The eKey. |
19 |
F | The fKey. |
20 |
G | The gKey. |
21 |
H | The hKey. |
22 |
I | The iKey. |
23 |
J | The jKey. |
24 |
K | The kKey. |
25 |
L | The lKey. |
26 |
M | The mKey. |
27 |
N | The nKey. |
28 |
O | The oKey. |
29 |
P | The pKey. |
30 |
Q | The qKey. |
31 |
R | The rKey. |
32 |
S | The sKey. |
33 |
T | The tKey. |
34 |
U | The uKey. |
35 |
V | The vKey. |
36 |
W | The wKey. |
37 |
X | The xKey. |
38 |
Y | The yKey. |
39 |
Z | The zKey. |
40 |
Digit1 | The digit1Key. |
41 |
Digit2 | The digit2Key. |
42 |
Digit3 | The digit3Key. |
43 |
Digit4 | The digit4Key. |
44 |
Digit5 | The digit5Key. |
45 |
Digit6 | The digit6Key. |
46 |
Digit7 | The digit7Key. |
47 |
Digit8 | The digit8Key. |
48 |
Digit9 | The digit9Key. |
49 |
Digit0 | The digit0Key. |
50 |
LeftShift | The leftShiftKey. |
51 |
RightShift | The rightShiftKey. |
52 |
LeftAlt | The leftAltKey. |
53 |
AltGr | Same as RightAlt. |
54 |
RightAlt | The rightAltKey. |
54 |
LeftCtrl | The leftCtrlKey. |
55 |
RightCtrl | The rightCtrlKey. |
56 |
LeftWindows | Same as LeftMeta. |
57 |
LeftApple | Same as LeftMeta. |
57 |
LeftMeta | The leftMetaKey. |
57 |
LeftCommand | Same as LeftMeta. |
57 |
RightCommand | Same as RightMeta. |
58 |
RightApple | Same as RightMeta. |
58 |
RightWindows | Same as RightMeta. |
58 |
RightMeta | The rightMetaKey. |
58 |
ContextMenu | The contextMenuKey. |
59 |
Escape | The escapeKey. |
60 |
LeftArrow | The leftArrowKey. |
61 |
RightArrow | The rightArrowKey. |
62 |
UpArrow | The upArrowKey. |
63 |
DownArrow | The downArrowKey. |
64 |
Backspace | The backspaceKey. |
65 |
PageDown | The pageDownKey. |
66 |
PageUp | The pageUpKey. |
67 |
Home | The homeKey. |
68 |
End | The endKey. |
69 |
Insert | The insertKey. |
70 |
Delete | The deleteKey. |
71 |
CapsLock | The capsLockKey. |
72 |
NumLock | The numLockKey. |
73 |
PrintScreen | The printScreenKey. |
74 |
ScrollLock | The scrollLockKey. |
75 |
Pause | The pauseKey. |
76 |
NumpadEnter | The numpadEnterKey. |
77 |
NumpadDivide | The numpadDivideKey. |
78 |
NumpadMultiply | The numpadMultiplyKey. |
79 |
NumpadPlus | The numpadPlusKey. |
80 |
NumpadMinus | The numpadMinusKey. |
81 |
NumpadPeriod | The numpadPeriodKey. |
82 |
NumpadEquals | The numpadEqualsKey. |
83 |
Numpad0 | The numpad0Key. |
84 |
Numpad1 | The numpad1Key. |
85 |
Numpad2 | The numpad2Key. |
86 |
Numpad3 | The numpad3Key. |
87 |
Numpad4 | The numpad4Key. |
88 |
Numpad5 | The numpad5Key. |
89 |
Numpad6 | The numpad6Key. |
90 |
Numpad7 | The numpad7Key. |
91 |
Numpad8 | The numpad8Key. |
92 |
Numpad9 | The numpad9Key. |
93 |
F1 | The f1Key. |
94 |
F2 | The f2Key. |
95 |
F3 | The f3Key. |
96 |
F4 | The f4Key. |
97 |
F5 | The f5Key. |
98 |
F6 | The f6Key. |
99 |
F7 | The f7Key. |
100 |
F8 | The f8Key. |
101 |
F9 | The f9Key. |
102 |
F10 | The f10Key. |
103 |
F11 | The f11Key. |
104 |
F12 | The f12Key. |
105 |
OEM1 | The oem1Key. |
106 |
OEM2 | The oem2Key. |
107 |
OEM3 | The oem3Key. |
108 |
OEM4 | The oem4Key. |
109 |
OEM5 | The oem5Key. |
110 |
IMESelected | 111 |