RealDocs

UKismetInputLibrary::Key_IsValid

function Engine Blueprint Since unknown
#include "Kismet/KismetInputLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns true if this is a valid, recognized key. An FKey constructed with an unrecognized name, or a default-constructed FKey, returns false.

Caveats & Gotchas

  • A default-constructed FKey (FKey()) is invalid — always check this before using a key value that may have come from an unset variable.
  • Validity only means the key name is recognized by the input system; it does not mean the key is currently bound to any action or axis mapping.

Signature

static bool Key_IsValid(const FKey& Key);

Parameters

Name Type Description Default
Key const FKey& The key to test.

Return Type

bool

Example

Guard against unset key variables C++
if (UKismetInputLibrary::Key_IsValid(BoundKey))
{
    PlayerInput->AddActionMapping(FInputActionKeyMapping("Fire", BoundKey));
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.