UGameplayTask

Windows
MacOS
Linux

Inheritance Hierarchy

UObjectBase

UObjectBaseUtility

UObject

UGameplayTask

UAbilityTask

UAbilityTask_ApplyRootMotion_Base

UAbilityTask_ApplyRootMotionConstantForce

UAbilityTask_ApplyRootMotionJumpForce

UAbilityTask_ApplyRootMotionMoveToActorForce

UAbilityTask_ApplyRootMotionMoveToForce

UAbilityTask_ApplyRootMotionRadialForce

UAbilityTask_MoveToLocation

UAbilityTask_NetworkSyncPoint

UAbilityTask_PlayMontageAndWait

UAbilityTask_Repeat

UAbilityTask_SpawnActor

UAbilityTask_StartAbilityState

UAbilityTask_VisualizeTargeting

UAbilityTask_WaitAbilityActivate

UAbilityTask_WaitAbilityCommit

UAbilityTask_WaitAttributeChange

UAbilityTask_WaitAttributeChangeRatioThreshold

UAbilityTask_WaitAttributeChangeThreshold

UAbilityTask_WaitCancel

UAbilityTask_WaitConfirm

UAbilityTask_WaitConfirmCancel

UAbilityTask_WaitDelay

UAbilityTask_WaitGameplayEffectApplied

UAbilityTask_WaitGameplayEffectApplied_Self

UAbilityTask_WaitGameplayEffectApplied_Target

UAbilityTask_WaitGameplayEffectBlockedImmunity

UAbilityTask_WaitGameplayEffectRemoved

UAbilityTask_WaitGameplayEffectStackChange

UAbilityTask_WaitGameplayEvent

UAbilityTask_WaitGameplayTag

UAbilityTask_WaitGameplayTagAdded

UAbilityTask_WaitGameplayTagRemoved

UAbilityTask_WaitInputPress

UAbilityTask_WaitInputRelease

UAbilityTask_WaitMovementModeChange

UAbilityTask_WaitOverlap

UAbilityTask_WaitTargetData

UAbilityTask_WaitVelocityChange

UAITask

UAITask_LockLogic

UAITask_MoveTo

UAITask_RunEQS

UGameplayTask_ClaimResource

UGameplayTask_SpawnActor

UGameplayTask_TimeLimitedExecution

UGameplayTask_WaitDelay

UMockTask_Log

References

Module

GameplayTasks

Header

/Engine/Source/Runtime/GameplayTasks/Classes/GameplayTask.h

Include

#include "GameplayTask.h"

Syntax

class UGameplayTask :
    public UObject ,
    public IGameplayTaskOwnerInterface

Variables

Name Description

Protected variable

uint32 : 1

 

bCaresAboutPriority

Protected variable

uint32 : 1

 

bClaimRequiredResources

Protected variable

uint32 : 1

 

bIsPausable

Protected variable

uint32 : 1

 

bIsSimulating

Am I actually running this as a simulated task.

Protected variable

uint32 : 1

 

bOwnedByTasksComponent

This is set to avoid duplicate calls to task's owner and TasksComponent when both are the same object

Protected variable

uint32 : 1

 

bOwnerFinished

Protected variable

uint32 : 1

 

bSimulatedTask

Should this task run on simulated clients? This should only be used in rare cases, such as movement tasks.

Protected variable

uint32 : 1

 

bTickingTask

If true, this task will receive TickTask calls from TasksComponent

Protected variable

UGameplayTask &...

 

ChildTask

Child task instance

Protected variable

FGameplayResour ...

 

ClaimedResources

Resources that are going to be locked when this task gets activated, but are not required to get this task started

Protected variable

FString

 

DebugDescription

Protected variable

FName

 

InstanceName

This name allows us to find the task later so that we can end it.

Protected variable

uint8

 

Priority

This controls how this task will be treaded in relation to other, already running tasks, provided GameplayTasksComponent is configured to care about priorities (the default behavior)

Protected variable

FGameplayResour ...

 

RequiredResources

Abstract "resource" IDs this task needs available to be able to get activated.

Protected variable

ETaskResourceOv ...

 

ResourceOverlapPolicy

Protected variable

TWeakInterfaceP ...

 

TaskOwner

Task Owner that created us

Protected variable

TWeakObjectPtr <...

 

TasksComponent

Protected variable

EGameplayTaskSt ...

 

TaskState

You should never access it directly.

Constructors

Name Description

Public function

UGameplayTask

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Protected function Virtual

void

 

Activate()

Called to trigger the actual task once the delegates have been set up Note that the default implementation does nothing and you don't have to call it

Public function

void

 

AddClaimedResource

Public function

void

 

AddClaimedResource()

Public function

void

 

AddClaimedResourceSet

(
    FGameplayResourceSet AdditionalReso...
)

Public function

void

 

AddClaimedResourceSet

(
    const TArray < TSubclassOf < UGamepla ...
)

Public function

void

 

AddRequiredResource()

Public function

void

 

AddRequiredResource

Marks this task as requiring specified resource which has a number of consequences, like task not being able to run if the resource is already taken.

Public function

void

 

AddRequiredResourceSet

(
    const TArray < TSubclassOf < UGamepla ...
)

Public function

void

 

AddRequiredResourceSet

(
    FGameplayResourceSet RequiredResour...
)

Protected function Static

IGameplayTas ...

 

ConvertToTaskOwner

(
    UObject & OwnerObject
)

Protected function Static

IGameplayTas ...

 

ConvertToTaskOwner

(
    AActor & OwnerActor
)

Public function

void

 

EndTask()

Called explicitly to end the task (usually by the task itself).

Public function Virtual

void

 

ExternalCancel()

Called when the task is asked to cancel from an outside node.

Public function Virtual

void

 

ExternalConfirm

(
    bool bEndTask
)

Called when the task is asked to confirm from an outside node.

Public function Virtual Const

FString

 

GenerateDebugDescription()

Public function Const

AActor *

 

GetAvatarActor()

Proper way to get the avatar actor associated with the task owner (usually a pawn, tower, etc)

Public function Const

UGameplayTas ...

 

GetChildTask()

Public function Const

FGameplayRes ...

 

GetClaimedResources()

Public function Const

const FStrin ...

 

GetDebugDescription()

Public function Virtual Const

FString

 

GetDebugString()

Return debug string describing task

Public function

UGameplayTas ...

 

GetGameplayTasksComponent()

Public function Const

UGameplayTas ...

 

GetGameplayTasksComponent()

Public function Const

FName

 

GetInstanceName()

Public function Const

AActor *

 

GetOwnerActor()

Proper way to get the owning actor of task owner.

Public function Const

uint8

 

GetPriority()

Public function Const

FGameplayRes ...

 

GetRequiredResources()

Public function Const

ETaskResourc ...

 

GetResourceOverlapPolicy()

Public function Const

EGameplayTas ...

 

GetState()

Public function Const

IGameplayTas ...

 

GetTaskOwner()

Public function Const

FString

 

GetTaskStateName()

Public function Virtual Const

UWorld *

 

GetWorld()

Helper function for getting UWorld off a task

Public function Const

bool

 

HasOwnerFinished()

Public function Virtual

void

 

InitSimulatedTask

(
    UGameplayTasksComponent & InGamepla...
)

Protected function

void

 

InitTask

(
    IGameplayTaskOwnerInterface & InTas...,
    uint8 InPriority
)

Initailizes the task with the task owner interface instance but does not actviate until Activate() is called

Public function Const

bool

 

IsActive()

Public function Const

bool

 

IsFinished()

Public function Const

bool

 

IsOwnedByTasksComponent()

Public function Const

bool

 

IsPausable()

Public function Const

bool

 

IsPaused()

Public function Const

bool

 

IsSimulatedTask()

Public function Const

bool

 

IsSimulating()

Public function Const

bool

 

IsTickingTask()

Public function Virtual Const

bool

 

IsWaitingOnAvatar()

Public function Virtual Const

bool

 

IsWaitingOnRemotePlayerdata()

Public function Static

T *

 

NewTask

(
    IGameplayTaskOwnerInterface & TaskO...,
    FName InstanceName
)

Public function Static

T *

 

NewTask

(
    TScriptInterface < IGameplayTaskOwne ...,
    FName InstanceName
)

Public function Static

T *

 

NewTask

(
    UObject * WorldContextObject,
    FName InstanceName
)

Helper function for instantiating and initializing a new task

Public function Static

T *

 

NewTask

(
    UObject & WorldContextObject,
    FName InstanceName
)

Public function Static

T *

 

NewTaskUninitialized()

Added for consistency with NewTask, but to indicate that a task requires manual call to InitTask This path is used to manually configure some aspects of the task, like Priority

Protected function Virtual

void

 

OnDestroy

(
    bool bInOwnerFinished
)

End and CleanUp the task - may be called by the task itself or by the task owner if the owner is ending.

Protected function Virtual

void

 

Pause()

Protected by design. Not meant to be called outside from GameplayTaskComponent mechanics

Public function

void

 

ReadyForActivation()

Called to trigger the actual task once the delegates have been set up

Public function Const

bool

 

RequiresPriorityOrResourceManagement()

Protected function Virtual

void

 

Resume()

Public function

void

 

TaskOwnerEnded()

Called when task owner has "ended" (before the task ends) kills the task. Calls OnDestroy.

Public function Virtual

void

 

TickTask

(
    float DeltaTime
)

Tick function for this task, if bTickingTask == true

Overridden from UObject

Name Description

Public function Virtual Const

bool

 

IsSupportedForNetworking()

IsSupportedForNetworking means an object can be referenced over the network

Overridden from IGameplayTaskOwnerInterface

Name Description

Protected function Virtual Const

AActor *

 

GetGameplayTaskAvatar

(
    const UGameplayTask * Task
)

Get "body" of task's owner / default, having location in world (e.g. Owner = AIController, Avatar = Pawn)

Protected function Virtual Const

uint8

 

GetGameplayTaskDefaultPriority()

Get default priority for running a task

Protected function Virtual Const

AActor *

 

GetGameplayTaskOwner

(
    const UGameplayTask * Task
)

Get owner of a task or default one when task is null

Protected function Virtual Const

UGameplayTas ...

 

GetGameplayTasksComponent

(
    const UGameplayTask & Task
)

Finds tasks component for given GameplayTask, Task.GetGameplayTasksComponent() may not be initialized at this point!

Protected function Virtual

void

 

OnGameplayTaskDeactivated

(
    UGameplayTask & Task
)

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

Protected function Virtual

void

 

OnGameplayTaskInitialized

(
    UGameplayTask & Task
)

Notify called after GameplayTask finishes initialization (not active yet)

Classes

Name

Description

Public class

FGenericGameplayTaskDelegate

Select Skin
Light
Dark

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