Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


keyCode

The key code.
Read time 1 minuteLast updated 4 days ago

Definition

public KeyCode keyCode { get; protected set; }

Remarks

This is the code of the physical key that was pressed. It doesn't take into account the keyboard layout, and it displays modifier keys, since a key was pressed. For example, pressing the "A" key will cause this property to return KeyCode.A regardless of whether the Shift key is pressed or not. The Shift key itself returns KeyCode.LeftShift since it is a physical key on the keyboard.