UKismetInputLibrary::GetKey
#include "Kismet/KismetInputLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the FKey associated with a keyboard input event, such as the key pressed in an OnKeyDown handler.
Caveats & Gotchas
- • Returns the physical key, not a translated character — use a character/text input event if you need localized text entry.
- • Named GetKey with no prefix, unlike the other KeyEvent helpers (Key_GetNavigationActionFromKey, etc.) — easy to confuse with the FKey struct itself when searching.
Signature
static FKey GetKey(const FKeyEvent& Input); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Input | const FKeyEvent& | The key event to read the pressed or released key from. | — |
Return Type
FKey Example
Handle Escape to close a menu widget C++
FReply UMyWidget::NativeOnKeyDown(const FGeometry& InGeometry, const FKeyEvent& InKeyEvent)
{
const FKey PressedKey = UKismetInputLibrary::GetKey(InKeyEvent);
if (PressedKey == EKeys::Escape)
{
CloseMenu();
return FReply::Handled();
}
return FReply::Unhandled();
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?