RealDocs

UBlackboardComponent::SetValueAsString

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

Description

Sets the string value stored under the given blackboard key, notifying any registered observers if the value changed.

Caveats & Gotchas

  • Takes StringValue by value, so each call copies/allocates an FString — prefer SetValueAsName for fixed identifier sets written frequently.
  • Silently does nothing if KeyName doesn't resolve to a string-type key on the blackboard's data asset.
  • Setting the same string value again does not re-notify observers, since notifications only fire on an actual change.

Signature

void SetValueAsString(const FName& KeyName, FString StringValue)

Parameters

Name Type Description Default
KeyName const FName& The name of the string blackboard key to write.
StringValue FString The string value to store under the key, passed by value.

Return Type

void

Example

Store a debug label C++
BlackboardComp->SetValueAsString(TEXT("DebugLabel"), FString::Printf(TEXT("State_%d"), StateIndex));

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.