RealDocs

UBehaviorTreeComponent::HandleMessage

function AIModule Since 4.0
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public Specifiers: virtualoverride

Description

Routes an incoming FAIMessage to the message observers registered via RegisterMessageObserver, resuming any latent task waiting on it.

Caveats & Gotchas

  • Called by the AI messaging system (FAIMessage::Send), not something you invoke directly in normal gameplay code.
  • Overrides UBrainComponent::HandleMessage; if you subclass UBehaviorTreeComponent, call Super::HandleMessage() first so existing observers still fire.

Signature

virtual void HandleMessage(const FAIMessage& Message) override;

Parameters

Name Type Description Default
Message const FAIMessage& The message being routed to any latent tasks that registered an observer for it.

Return Type

void

Example

Extend message handling in a subclass C++
void UMyBehaviorTreeComponent::HandleMessage(const FAIMessage& Message)
{
	Super::HandleMessage(Message);
	UE_LOG(LogTemp, Verbose, TEXT("BT received message: %s"), *Message.MessageName.ToString());
}

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.