UBTTaskNode

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

Windows
MacOS
Linux

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 Const

void

 

FinishLatentAbort

(
    UBehaviorTreeComponent& OwnerComp
)

Helper function: finishes latent aborting

Public function Const

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 Const

bool

 

ShouldIgnoreRestartSelf()

Protected function Const

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 Const

void

 

WaitForMessage

(
    UBehaviorTreeComponent& OwnerComp,
    FName MessageType
)

Register message observer

Protected function Const

void

 

WaitForMessage

(
    UBehaviorTreeComponent& OwnerComp,
    FName MessageType,
    int32 RequestID
)

Register message observer

Public function Const

EBTNodeResul...

 

WrappedAbortTask

(
    UBehaviorTreeComponent& OwnerComp,
    uint8* NodeMemory
)

Wrapper for node instancing: AbortTask

Public function Const

EBTNodeResul...

 

WrappedExecuteTask

(
    UBehaviorTreeComponent& OwnerComp,
    uint8* NodeMemory
)

Wrapper for node instancing: ExecuteTask

Public function Const

void

 

WrappedOnTaskFinished

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

Wrapper for node instancing: OnTaskFinished

Public function Const

void

 

WrappedTickTask

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

Wrapper for node instancing: TickTask

Overridden from UBTNode

Name Description

Public function Virtual Const

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
)

Notify called after GameplayTask changes state from Active (finishing or pausing)

References

Module

AIModule

Header

Runtime/AIModule/Classes/BehaviorTree/BTTaskNode.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback