UBlackboardComponent
#include "BehaviorTree/BlackboardComponent.h" Description
A component that stores key-value pairs for AI decision-making. Acts as shared memory between the behavior tree, decorators, services, and C++ game code.
Caveats & Gotchas
- • Keys must be defined in the UBlackboardData asset in the editor — you cannot add keys at runtime.
- • Get the component via AAIController::GetBlackboardComponent(). It is null until UseBlackboard() or RunBehaviorTree() has been called.
- • Key names are FName lookups — typos silently fail and return default values. Prefer caching key IDs with GetKeyID() in production code.
Example
Write and read a blackboard value from C++ C++
UBlackboardComponent* BB = AIController->GetBlackboardComponent();
BB->SetValueAsObject(FName("TargetActor"), EnemyActor);
UObject* Target = BB->GetValueAsObject(FName("TargetActor")); Functions (6)
Blackboard 6 ▼
| Access | Type | Name |
|---|---|---|
| public | function | UBlackboardComponent::GetValueAsFloat |
| public | function | UBlackboardComponent::GetValueAsObject |
| public | function | UBlackboardComponent::GetValueAsVector |
| public | function | UBlackboardComponent::SetValueAsFloat |
| public | function | UBlackboardComponent::SetValueAsObject |
| public | function | UBlackboardComponent::SetValueAsVector |
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?