UBlackboardComponent::GetKeyType
#include "BehaviorTree/BlackboardComponent.h"
Access: public
Specifiers: const
Description
Returns the UBlackboardKeyType subclass (Bool, Int, Float, Object, Vector, and so on) used to store the value under the given key.
Caveats & Gotchas
- • Returns null if the KeyID is invalid or the blackboard has no asset assigned.
- • Use IsKeyOfType<T> instead when you already know the expected type at compile time and just need a bool check.
Signature
TSubclassOf<UBlackboardKeyType> GetKeyType(FBlackboard::FKey KeyID) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| KeyID | FBlackboard::FKey | The key ID to look up. | — |
Return Type
TSubclassOf<UBlackboardKeyType> Example
Check a key's underlying type C++
if (BlackboardComp->GetKeyType(KeyID) == UBlackboardKeyType_Object::StaticClass())
{
UObject* Value = BlackboardComp->GetValueAsObject(BlackboardComp->GetKeyName(KeyID));
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?