RealDocs

UBlackboardComponent::GetLocationFromEntry

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

Description

Resolves a world location from the given blackboard key, whether it's a Vector key or an Object/Actor key, and writes it to ResultLocation. Returns false if resolution failed, such as an unset key or a destroyed actor reference.

Caveats & Gotchas

  • Works with both Vector-type keys and Object-type keys pointing at an Actor — it internally figures out which and extracts a location either way, so it's more forgiving than calling GetValueAsVector directly.
  • Returns false (not a zero vector) on failure, so always check the return value before trusting ResultLocation — a stale FVector left in ResultLocation on failure is a common source of bugs.
  • Fails for an Object key whose stored actor has been destroyed, since the underlying object reference resolves to nullptr.

Signature

bool GetLocationFromEntry(const FName& KeyName, FVector& ResultLocation) const

Parameters

Name Type Description Default
KeyName const FName& The name of the blackboard key to read a location from.
ResultLocation FVector& Out parameter receiving the resolved world location.

Return Type

bool

Example

Move to a blackboard-stored target location C++
FVector TargetLocation;
if (BlackboardComp->GetLocationFromEntry(TEXT("TargetLocation"), TargetLocation))
{
    AIController->MoveToLocation(TargetLocation);
}

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.