UBTTaskNode::FinishLatentTask
#include "BehaviorTree/BTTaskNode.h"
Access: public
Specifiers: const
Description
Call this to complete a task that previously returned InProgress from ExecuteTask, such as one waiting on an async operation or a timer.
Caveats & Gotchas
- • Must be called with Succeeded or Failed — calling it with InProgress leaves the task in a stuck state.
- • Only valid to call after ExecuteTask returned InProgress; calling it without a pending latent execution has no matching state to complete.
- • Safe to call from an async callback or delegate fired later in the frame or on a subsequent tick, which is the primary reason latent tasks exist.
Signature
void FinishLatentTask(UBehaviorTreeComponent& OwnerComp, EBTNodeResult::Type TaskResult) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OwnerComp | UBehaviorTreeComponent& | The behavior tree component to notify of completion. | — |
| TaskResult | EBTNodeResult::Type | The final result to report — Succeeded or Failed. | — |
Return Type
void Example
Complete a latent task after a delay C++
EBTNodeResult::Type UMyTask::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
OwnerComp.GetWorld()->GetTimerManager().SetTimer(TimerHandle, [this, &OwnerComp]()
{
FinishLatentTask(OwnerComp, EBTNodeResult::Succeeded);
}, 2.0f, false);
return EBTNodeResult::InProgress;
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?