Skip to content

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_nametypedescription
keyKeyCodeThe key enumeration value.

return

typedescription
booleanWhether the key is pressed.

code example

typescript
OnUpdate(): void {

    let result = Input.GetKeyDown(KeyCode.Backspace);
        
    if (result) {
        Debug.Log("····Pressed Backspace key····");
    } 
}