Language:
Discover
By Skill Level
By Category

UBTTaskNode

Choose your OS:

Inheritance Hierarchy

Syntax

class UBTTaskNode : public UBTNode

Remarks

Task are leaf nodes of behavior tree, which perform actual actions

Because some of them can be instanced for specific AI, following virtual functions are not marked as const:

  • ExecuteTask

  • AbortTask

  • TickTask

  • OnMessage

If your node is not being instanced (default behavior), DO NOT change any properties of object within those functions! Template nodes are shared across all behavior tree components using the same tree asset and must store their runtime properties in provided NodeMemory block (allocation size determined by GetInstanceMemorySize() )

Variables

Name Description

Protected variable

uint32 : 1

 

bIgnoreRestartSelf

If set, task search will be discarded when this task is selected to execute but is already running

Protected variable

uint32 : 1

 

bNotifyTaskFinished

If set, OnTaskFinished will be called

Protected variable

uint32 : 1

 

bNotifyTick

If set, TickTask will be called

Public variable

TArray < UBTServ ...

 

Services

Service nodes

Constructors

Name Description

Public function

UBTTaskNode

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Protected function Virtual

EBTNodeResul ...

 

AbortTask

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory
)

Aborts this task, should return Aborted or InProgress (use FinishLatentAbort() when returning InProgress) this function should be considered as const (don't modify state of object) if node is not instanced!

Public function Virtual

EBTNodeResul ...

 

ExecuteTask

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory
)

Starts this task, should return Succeeded, Failed or InProgress (use FinishLatentTask() when returning InProgress) this function should be considered as const (don't modify state of object) if node is not instanced!

Public function

void

 

FinishLatentAbort

(
    UBehaviorTreeComponent & OwnerComp
)

Helper function: finishes latent aborting

Public function

void

 

FinishLatentTask

(
    UBehaviorTreeComponent & OwnerComp,
    EBTNodeResult::Type TaskResult
)

Helper function: finish latent executing

Protected function Virtual

void

 

OnMessage

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory,
    FName Message,
    int32 RequestID,
    bool bSuccess
)

Message handler, default implementation will finish latent execution/abortion this function should be considered as const (don't modify state of object) if node is not instanced!

Protected function Virtual

void

 

OnTaskFinished

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory,
    EBTNodeResult::Type TaskResult
)

Called when task execution is finished this function should be considered as const (don't modify state of object) if node is not instanced!

Public function

void

 

ReceivedMessage

(
    UBrainComponent * BrainComp,
    const FAIMessage & Message
)

Message observer's hook

Public function

bool

 

ShouldIgnoreRestartSelf()

True if task search should be discarded when this task is selected to execute but is already running

Protected function

void

 

StopWaitingForMessages

(
    UBehaviorTreeComponent & OwnerComp
)

Unregister message observers

Protected function Virtual

void

 

TickTask

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory,
    float DeltaSeconds
)

Ticks this task this function should be considered as const (don't modify state of object) if node is not instanced!

Protected function

void

 

WaitForMessage

(
    UBehaviorTreeComponent & OwnerComp,
    FName MessageType
)

Register message observer

Protected function

void

 

WaitForMessage

(
    UBehaviorTreeComponent & OwnerComp,
    FName MessageType,
    int32 RequestID
)

Public function

EBTNodeResul ...

 

WrappedAbortTask

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory
)

Wrapper for node instancing: AbortTask

Public function

EBTNodeResul ...

 

WrappedExecuteTask

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory
)

Wrapper for node instancing: ExecuteTask

Public function

void

 

WrappedOnTaskFinished

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory,
    EBTNodeResult::Type TaskResult
)

Wrapper for node instancing: OnTaskFinished

Public function

void

 

WrappedTickTask

(
    UBehaviorTreeComponent & OwnerComp,
    uint8 * NodeMemory,
    float DeltaSeconds
)

Wrapper for node instancing: TickTask

Overridden from UBTNode

Name Description

Public function Virtual

FName

 

GetNodeIconName()

Get the name of the icon used to display this node in the editor

Overridden from IGameplayTaskOwnerInterface

Name Description

Public function Virtual

void

 

OnGameplayTaskDeactivated

(
    UGameplayTask & Task
)

WITH_EDITOR.

References

Module

AIModule

Header

Runtime/AIModule/Classes/BehaviorTree/BTTaskNode.h