format
typescript
Input.GetKeyDown(key)class: Input
description
Detects whether the specified key is pressed in the current frame's key down event.
Returns true only when the key is pressed for the first time in this frame.
parameter
| param_name | type | description |
|---|---|---|
| key | KeyCode | The key enumeration value. |
return
| type | description |
|---|---|
boolean | Whether the key is pressed. |
code example
typescript
OnUpdate(): void {
let result = Input.GetKeyDown(KeyCode.Backspace);
if (result) {
Debug.Log("····Pressed Backspace key····");
}
}