GetKey

bool GetKey(string description) bool GetKey(int descriptionHash)

Parameters

description: The name of the key, as defined in SetKey(). descriptionHash: The hashcode of the name of the key, as defined in SetKey().

Returns

bool: Returns true if the key is being held down.

Description

Use this to determine if a key is being held down. GetKey() returns true repeatedly while the user holds down the key, and returns false if the key is not being pressed.

The use of GetKeyDown() or GetKeyUp() is recommended if you want to trigger an event only once per keypress, e.g., for jumping.

Example

Last updated