You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.7 KiB
3.7 KiB
On Keyboard Input node
[!NOTE] The On Keyboard Input [!includenodes-note-manual]
The On Keyboard Input node listens for a specified action on a keyboard key. [!includenodes-desc-end]
Fuzzy finder category
The On Keyboard Input node is in the Events > Input category in the fuzzy finder.
Inputs
The On Keyboard Input [!includenodes-inputs]
Name | Type | Description | |
---|---|---|---|
Key | Key Code | The name of the keyboard key the node listens to for an Input event. For a list of all available keys, see the KeyCode page's Properties section in the Unity User manual. | |
Action | Press State | The specific press state of the key that the node listens for. | |
Hold | The user holds down the key. | ||
Down | The user presses the key. | ||
Up | The user releases the key. |
Additional node settings
The On Keyboard Input [!includenodes-additional-settings]
[!include[nodes-coroutine](./snippets/nodes-coroutine.md)]Name | Type | Description |
---|
Outputs
The On Keyboard Input [!includenodes-single-output]
[!include[nodes-input-output-trigger](./snippets/input-manager/nodes-input-output-trigger.md)]Name | Type | Description |
---|
Example graph usage
In the following example, the On Keyboard Input node listens for when the user presses the Space key. When the user presses Space, the On Keyboard Input triggers the Transform Translate node and lifts the GameObject along its Y
coordinate by 5
units. This makes the GameObject jump.
Related nodes
[!includenodes-related] the On Keyboard Input node: