RealDocs

UBlackboardComponent::CompareKeyValues

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

Description

Compares the values stored under two keys using KeyType's comparison logic, returning Less, Equal, or Greater.

Caveats & Gotchas

  • KeyA and KeyB must both hold values of KeyType, or the result is meaningless — there's no runtime type check.
  • Used internally by blackboard-based decorators such as Compare Blackboard Values rather than typically called from gameplay code directly.

Signature

EBlackboardCompare::Type CompareKeyValues(TSubclassOf<UBlackboardKeyType> KeyType, FBlackboard::FKey KeyA, FBlackboard::FKey KeyB) const

Parameters

Name Type Description Default
KeyType TSubclassOf<UBlackboardKeyType> Key type class whose comparison logic should be used.
KeyA FBlackboard::FKey First key to compare.
KeyB FBlackboard::FKey Second key to compare.

Return Type

EBlackboardCompare::Type

Example

Comparing two float keys C++
const EBlackboardCompare::Type Result = BlackboardComp->CompareKeyValues(
    UBlackboardKeyType_Float::StaticClass(), KeyA, KeyB);
if (Result == EBlackboardCompare::Less)
{
    // KeyA's value is less than KeyB's
}

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.