UBlackboardComponent::IsKeyOfType
#include "BehaviorTree/BlackboardComponent.h"
Access: public
Specifiers: const
Description
Returns true if the named key's underlying value type matches the given UBlackboardKeyType subclass, specified as the template argument.
Caveats & Gotchas
- • TDataClass must be a UBlackboardKeyType subclass such as UBlackboardKeyType_Bool or UBlackboardKeyType_Object — passing anything else fails to compile.
- • Also has an FBlackboard::FKey overload; prefer it in hot paths since it skips the name-to-ID lookup.
- • Returns false (not an assert or error) if the key doesn't exist at all, so it doubles as an existence check for that type.
Signature
template<class TDataClass> bool IsKeyOfType(const FName& KeyName) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| KeyName | const FName& | Name of the blackboard key to check. | — |
Return Type
bool Example
Check a key's type before templated access C++
if (BlackboardComp->IsKeyOfType<UBlackboardKeyType_Bool>(TEXT("IsAlerted")))
{
bool Value = BlackboardComp->GetValue<UBlackboardKeyType_Bool>(TEXT("IsAlerted"));
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?