RealDocs

UBlackboardComponent::GetKeyID

function AIModule Since 4.0
#include "BehaviorTree/BlackboardComponent.h"
Access: public Specifiers: const

Description

Converts a blackboard key name into its numeric FKey ID, which is the form used by the fast RegisterObserver, GetValue, and SetValue overloads.

Caveats & Gotchas

  • Returns FBlackboard::InvalidKey if no key with that name exists on the current blackboard asset.
  • Prefer caching the returned FKey rather than looking it up by name every tick — name lookups walk the key array on the data asset.

Signature

FBlackboard::FKey GetKeyID(const FName& KeyName) const

Parameters

Name Type Description Default
KeyName const FName& Name of the blackboard key to look up.

Return Type

FBlackboard::FKey

Example

Cache a key ID once for repeated use C++
FBlackboard::FKey HealthKeyID = BlackboardComp->GetKeyID(TEXT("Health"));
// reuse HealthKeyID in later GetValue/SetValue calls instead of the name

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.