UBlackboardComponent::GetValueAsBool
#include "BehaviorTree/BlackboardComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Returns the boolean value stored under the given blackboard key. The most common blackboard read, used to gate behavior tree branches on flags like HasLineOfSight or IsAlerted.
Caveats & Gotchas
- • Returns false silently for a missing key or wrong-type key — you cannot distinguish 'false' from 'never set' or 'no such key'.
- • Key lookup is by FName every call; cache the FBlackboard::FKey with GetKeyID() if you read the same key every tick from C++.
- • Behavior tree decorators evaluate this same underlying value, so changing it from C++ mid-tick can immediately re-trigger decorator conditions and abort running branches.
Signature
bool GetValueAsBool(const FName& KeyName) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| KeyName | const FName& | The name of the bool blackboard key to read. | — |
Return Type
bool Example
Gate logic on a blackboard flag C++
if (BlackboardComp->GetValueAsBool(TEXT("HasLineOfSight")))
{
StartFiring();
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?