RealDocs

UBlackboardComponent::GetValueAsObject

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

Description

Returns the UObject stored under the given blackboard key, or null if the key doesn't exist or holds no value.

Signature

UObject* GetValueAsObject(const FName& KeyName) const

Parameters

Name Type Description Default
KeyName const FName& The name of the blackboard key to read.

Return Type

UObject*

Caveats & Gotchas

  • Returns null silently for missing keys — always check the return value before use.
  • Cast the result to the expected type. The blackboard stores any UObject subclass under Object keys.
  • For high-frequency reads, cache the key ID with GetKeyID() and use the ID-based overload to avoid repeated FName lookups.

Example

Get a target actor from the blackboard C++
AActor* Target = Cast<AActor>(BlackboardComp->GetValueAsObject(FName("TargetActor")));
if (Target)
{
    MoveToActor(Target);
}

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.