RealDocs

UBlackboardComponent::SetValueAsBool

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

Description

Sets the boolean value stored under the given blackboard key, notifying any registered observers if the value changed. The most common blackboard write, used to raise or clear AI flags.

Caveats & Gotchas

  • Silently does nothing if KeyName doesn't resolve to a bool-type key on the blackboard's data asset.
  • Setting the same boolean value again does not re-notify observers — decorators listening for a change on this key won't re-evaluate.
  • Because behavior tree decorators can observe this key and abort running branches immediately on change, calling this mid-tick from C++ can interrupt the currently executing task synchronously.

Signature

void SetValueAsBool(const FName& KeyName, bool BoolValue)

Parameters

Name Type Description Default
KeyName const FName& The name of the bool blackboard key to write.
BoolValue bool The boolean value to store under the key.

Return Type

void

Example

Raise an alert flag C++
BlackboardComp->SetValueAsBool(TEXT("IsAlerted"), true);

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.