RealDocs

UBlackboardComponent::GetValueAsString

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

Description

Returns the string value stored under the given blackboard key. Useful for storing free-form identifiers, debug labels, or dialogue keys as AI state.

Caveats & Gotchas

  • Returns an empty FString for a missing key or wrong-type key — indistinguishable from a legitimately empty string.
  • String blackboard keys are heavier than Name keys (heap-allocated FString vs interned FName); prefer GetValueAsName for fixed identifier sets.
  • Key lookup is by FName every call; cache the key ID with GetKeyID() if reading every tick.

Signature

FString GetValueAsString(const FName& KeyName) const

Parameters

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

Return Type

FString

Example

Read a debug label from the blackboard C++
FString Label = BlackboardComp->GetValueAsString(TEXT("DebugLabel"));
UE_LOG(LogTemp, Log, TEXT("AI state label: %s"), *Label);

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.