RealDocs

UBlackboardComponent::IsValidKey

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

Description

Checks whether KeyID refers to a valid entry in the component's blackboard asset.

Caveats & Gotchas

  • Asserts (check(BlackboardAsset)) if no blackboard asset has been assigned yet — call HasValidAsset() first if that's uncertain.
  • Validates the key ID against the asset's key list, not whether the key currently has a value set; an unset key still counts as valid.

Signature

inline bool IsValidKey(FBlackboard::FKey KeyID) const

Parameters

Name Type Description Default
KeyID FBlackboard::FKey Key ID to validate, typically obtained from GetKeyID.

Return Type

bool

Example

Guarding a cached key ID C++
if (BlackboardComp->IsValidKey(CachedKeyID))
{
    const float Value = BlackboardComp->GetValueAsFloat(TEXT("Speed"));
}

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.