RealDocs

UBlackboardComponent::SetValueAsClass

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

Description

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

Caveats & Gotchas

  • Silently does nothing if KeyName doesn't resolve to a valid class-type key on the blackboard's data asset.
  • Setting the same class value again does not re-notify observers — notifications only fire when the stored value actually changes.
  • If the key has a base-class restriction configured on the BlackboardData asset, passing an incompatible class is rejected without an error message in Development builds.

Signature

void SetValueAsClass(const FName& KeyName, UClass* ClassValue)

Parameters

Name Type Description Default
KeyName const FName& The name of the class blackboard key to write.
ClassValue UClass* The class to store under the key.

Return Type

void

Example

Store a chosen spawn class C++
BlackboardComp->SetValueAsClass(TEXT("TargetClass"), AEnemyPawn::StaticClass());

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.