> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/3.1/api/csharp/yarn.unity/yarn.unity.inputsystemavailability/yarn.unity.inputsystemavailability.getkeydown.md).

# GetKeyDown(KeyCode)

Method in [InputSystemAvailability](/3.1/api/csharp/yarn.unity/yarn.unity.inputsystemavailability.md)

## Summary

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

```csharp
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.
