RealDocs

UBTTaskNode::WrappedOnTaskFinished

function AIModule Since 4.0
#include "BehaviorTree/BTTaskNode.h"
Access: public Specifiers: const

Description

Internal wrapper the runtime calls to invoke OnTaskFinished on an instanced node when a task completes. It only actually calls through if bNotifyTaskFinished was set.

Caveats & Gotchas

  • Only fires when bNotifyTaskFinished is true, which is set automatically by calling INIT_TASK_NODE_NOTIFY_FLAGS in the task's constructor if OnTaskFinished is overridden.
  • Not intended to be called or overridden directly; override OnTaskFinished instead.
  • Runs regardless of whether the task succeeded, failed, or was aborted — check TaskResult if the behavior should differ.

Signature

void WrappedOnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult) const;

Parameters

Name Type Description Default
OwnerComp UBehaviorTreeComponent& The behavior tree component driving execution.
NodeMemory uint8* Pointer to this node's instance memory block.
TaskResult EBTNodeResult::Type The result the task finished with.

Return Type

void

Example

React to task completion C++
UMyTask::UMyTask(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	INIT_TASK_NODE_NOTIFY_FLAGS();
}

void UMyTask::OnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult)
{
	// Called via WrappedOnTaskFinished() by the BT runtime
}

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.