RealDocs

UBlackboardComponent::CopyKeyValue

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

Description

Copies the raw value stored under SourceKeyID into DestinationID and returns true if the copy succeeded.

Caveats & Gotchas

  • Both keys must hold the same underlying UBlackboardKeyType; copying between mismatched types (e.g. Vector into Bool) fails and returns false.
  • Triggers a change notification on the destination key, so any registered observers on DestinationID will fire as if SetValue had been called directly.

Signature

bool CopyKeyValue(FBlackboard::FKey SourceKeyID, FBlackboard::FKey DestinationID)

Parameters

Name Type Description Default
SourceKeyID FBlackboard::FKey Key to copy the value from.
DestinationID FBlackboard::FKey Key to copy the value into.

Return Type

bool

Example

Duplicate a key's value into another key C++
FBlackboard::FKey SourceID = BlackboardComp->GetKeyID(TEXT("TargetLocation"));
FBlackboard::FKey DestID = BlackboardComp->GetKeyID(TEXT("LastKnownLocation"));
BlackboardComp->CopyKeyValue(SourceID, DestID);

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.