UBTTaskNode::ReceivedMessage
#include "BehaviorTree/BTTaskNode.h"
Access: public
Description
The message observer hook invoked when a task registered interest in a message type via WaitForMessage and a matching message arrives. It forwards to OnMessage internally.
Caveats & Gotchas
- • Not meant to be called or overridden directly — override OnMessage instead, this is the plumbing that the message observer system invokes.
- • Only fires if the task previously called WaitForMessage for the matching MessageType/RequestID.
- • The default OnMessage implementation finishes the latent task/abort, so a naive override that forgets to call the base can leave a task stuck in-progress.
Signature
void ReceivedMessage(UBrainComponent* BrainComp, const FAIMessage& Message); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| BrainComp | UBrainComponent* | The brain component that routed the message. | — |
| Message | const FAIMessage& | The message payload delivered to the observer. | — |
Return Type
void Example
Register for a message then react C++
EBTNodeResult::Type UMyTask::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
WaitForMessage(OwnerComp, TEXT("TaskComplete"));
return EBTNodeResult::InProgress;
}
// ReceivedMessage is invoked by the engine when a matching FAIMessage arrives,
// which internally calls OnMessage() on this task. Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?