UBlackboardComponent::GetValue
#include "BehaviorTree/BlackboardComponent.h"
Access: public
Specifiers: templateconst
Description
Reads the value stored under the given key, decoded as the type described by the TDataClass template argument. Requires an explicit template argument, e.g. GetValue<UBlackboardKeyType_Bool>(KeyName).
Caveats & Gotchas
- • TDataClass must match the actual key type stored in the blackboard asset; a mismatch returns TDataClass::InvalidValue rather than raising an error.
- • Prefer the GetValueAsBool/GetValueAsInt/etc. wrapper functions for Blueprint or general gameplay code — this template overload exists mainly for custom key types and internal engine use.
- • There's also an FBlackboard::FKey overload, which skips the name-to-ID lookup and is cheaper when repeatedly querying the same key.
Signature
template<class TDataClass>
typename TDataClass::FDataType GetValue(const FName& KeyName) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| KeyName | const FName& | Name of the blackboard key to read. | — |
Return Type
TDataClass::FDataType Example
Reading a custom key type C++
UBlackboardComponent* BlackboardComp = GetBlackboardComponent();
const bool bTargetVisible = BlackboardComp->GetValue<UBlackboardKeyType_Bool>(TEXT("TargetVisible")); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?