RealDocs

UBlackboardComponent::GetNumKeys

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

Description

Returns the number of key entries defined on the blackboard's data asset, including keys inherited from parent blackboard assets.

Caveats & Gotchas

  • Returns 0 if the blackboard has no valid asset assigned yet.
  • Mainly useful for iterating all keys (0 to GetNumKeys()-1) with GetKeyName/GetKeyType, e.g. for debug displays.

Signature

int32 GetNumKeys() const

Return Type

int32

Example

Iterate every key on the blackboard C++
for (int32 KeyID = 0; KeyID < BlackboardComp->GetNumKeys(); ++KeyID)
{
    UE_LOG(LogTemp, Log, TEXT("Key %d: %s"), KeyID, *BlackboardComp->GetKeyName(KeyID).ToString());
}

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.