GetKeyDown(KeyCode)

Method in InputSystemAvailability

Summary

Gets a value indicating whether the key indicated by a UnityEngine.KeyCode was pressed this frame.

public static bool GetKeyDown(KeyCode key)

Remarks

If the Legacy Input Manager is enabled, this method wraps UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode) . Otherwise, it attempts to find the UnityEngine.InputSystem.Key equivalent of key , and then checks with UnityEngine.InputSystem.Keyboard.current to find the key, and queries its UnityEngine.InputSystem.Controls.ButtonControl.wasPressedThisFrame property.

Parameters

Name
Description

KeyCode key

The UnityEngine.KeyCode to check for the state of.

Returns

Whether the key was pressed this frame.

Last updated

Was this helpful?