RealDocs

UBlackboardComponent::IsVectorValueSet

function AIModule Blueprint Since 4.0
#include "BehaviorTree/BlackboardComponent.h"
Access: public Specifiers: const

Description

Returns true if the vector value under the given key has actually been set (rather than left at its default invalid state).

Caveats & Gotchas

  • Unlike most numeric key types, vector keys distinguish 'unset' from a zero vector — a fresh FVector::ZeroVector value is not the same as no value at all.
  • Also returns false if the key specified doesn't hold a vector type at all, not just when it's genuinely unset.
  • Also has an FBlackboard::FKey overload for callers that already resolved the key ID.

Signature

bool IsVectorValueSet(const FName& KeyName) const

Parameters

Name Type Description Default
KeyName const FName& Name of the vector-typed blackboard key to check.

Return Type

bool

Example

Check before reading a vector key C++
if (BlackboardComp->IsVectorValueSet(TEXT("LastKnownLocation")))
{
    FVector Location = BlackboardComp->GetValueAsVector(TEXT("LastKnownLocation"));
}

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.