UGameplayTasksComponent

The core ActorComponent for interfacing with the GameplayAbilities System

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

GameplayTasks

Header

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

Include

#include "GameplayTasksComponent.h"

Syntax

class UGameplayTasksComponent :
    public UActorComponent ,
    public IGameplayTaskOwnerInterface

Remarks

The core ActorComponent for interfacing with the GameplayAbilities System

Variables

Name Description

Public variable

uint8 : 1

 

bIsNetDirty

Set to indicate that GameplayTasksComponent needs immediate replication.

Protected variable

FGameplayResour ...

 

CurrentlyClaimedResources

Resources used by currently active tasks

Protected variable

TArray < UGamepl ...

 

KnownTasks

All known tasks (processed by this component) referenced for GC

Public variable

FOnClaimedResou ...

 

OnClaimedResourcesChange

Protected variable

TArray < FGamepl ...

 

TaskEvents

Transient array of events whose main role is to avoid long chain of recurrent calls if an activated/paused/removed task wants to push/pause/kill other tasks.

Protected variable

TArray < UGamepl ...

 

TaskPriorityQueue

Protected variable

TArray < UGamepl ...

 

TickingTasks

Array of currently active UGameplayTask that require ticking

Protected variable

uint8

 

TopActivePriority

Indicates what's the highest priority among currently running tasks

Constructors

Name Description

Public function

UGameplayTasksComponent

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Public function

void

 

AddTaskReadyForActivation

(
    UGameplayTask & NewTask
)

Processes the task and figures out if it should get triggered instantly or wait based on task's RequiredResources, Priority and ResourceOverlapPolicy

Public function Const

void

 

DescribeSelfToVisLog

(
    FVisualLogEntry * Snapshot
)

Public function

void

 

EndAllResourceConsumingTasksOwnedBy

(
    const IGameplayTaskOwnerInterface &...
)

Public function Const

bool

 

FindAllResourceConsumingTasksOwnedBy

(
    const IGameplayTaskOwnerInterface &...,
    TArray < UGameplayTask * >& Fou...
)

Public function Const

UGameplayTas ...

 

FindResourceConsumingTaskByName

(
    const FName TaskInstanceName
)

Finds first resource-consuming task of given name

Public function Const

FGameplayRes ...

 

GetCurrentlyUsedResources()

Public function Const

FConstGamepl ...

 

GetKnownTaskIterator()

Public function Const

FString

 

GetKnownTasksDescription()

Public function Const

FConstGamepl ...

 

GetPriorityQueueIterator()

Public function Virtual Const

bool

 

GetShouldTick()

Retrieves information whether this component should be ticking taken current activity into consideration

Protected function

const TArray ...

 

GetSimulatedTasks()

Protected function

TArray < UGam ...

 

GetSimulatedTasks_Mutable()

Public function Const

FString

 

GetTasksPriorityQueueDescription()

Public function Static

FString

 

GetTaskStateName

(
    EGameplayTaskState Value
)

Public function Const

FConstGamepl ...

 

GetTickingTaskIterator()

Public function Const

FString

 

GetTickingTasksDescription()

Public function Const

bool

 

HasActiveTasks

(
    UClass * TaskClass
)

Public function Static

EGameplayTas ...

 

K2_RunGameplayTask

(
    TScriptInterface < IGameplayTaskOwne ...,
    UGameplayTask * Task,
    uint8 Priority,
    TArray < TSubclassOf < UGameplayTaskR ...,
    TArray < TSubclassOf < UGameplayTaskR ...
)

Public function

void

 

OnRep_SimulatedTasks()

Protected function

void

 

ProcessTaskEvents()

Public function

void

 

RemoveResourceConsumingTask

(
    UGameplayTask & Task
)

Protected function

void

 

RequestTicking()

Public function Static

EGameplayTas ...

 

RunGameplayTask

(
    IGameplayTaskOwnerInterface & TaskO...,
    UGameplayTask & Task,
    uint8 Priority,
    FGameplayResourceSet AdditionalRequ...,
    FGameplayResourceSet AdditionalClai...
)

Protected function

void

 

SetCurrentlyClaimedResources

(
    FGameplayResourceSet NewClaimedSet
)

Protected function

void

 

SetSimulatedTasks

(
    const TArray < UGameplayTask * >...
)

Public function

void

 

UpdateShouldTick()

Protected function

void

 

UpdateTaskActivations()

Overridden from UActorComponent

Name Description

Public function Virtual

bool

 

ReplicateSubobjects

(
    UActorChannel * Channel,
    FOutBunch * Bunch,
    FReplicationFlags * RepFlags
)

Allows a component to replicate other subobject on the actor

Public function Virtual

void

 

TickComponent

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction * T...
)

Function called every frame on this ActorComponent.

Overridden from UObject

Name Description

Public function Virtual Const

void

 

GetLifetimeReplicatedProps

(
    TArray < FLifetimeProperty >& OutLi...
)

Returns properties that are replicated for the lifetime of the actor channel

Overridden from IGameplayTaskOwnerInterface

Name Description

Public 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)

Public function Virtual Const

AActor *

 

GetGameplayTaskOwner

(
    const UGameplayTask * Task
)

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

Public function Virtual Const

UGameplayTas ...

 

GetGameplayTasksComponent

(
    const UGameplayTask & Task
)

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

Public function Virtual

void

 

OnGameplayTaskActivated

(
    UGameplayTask & Task
)

Notify called after GameplayTask changes state to Active (initial activation or resuming)

Public function Virtual

void

 

OnGameplayTaskDeactivated

(
    UGameplayTask & Task
)

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

Classes

Name

Description

Protected struct

FEventLock

Deprecated Variables

Name Description

Protected variable

TArray < UGamepl ...

 

SimulatedTasks

This will be made private in future versions. Use GetSimulatedTasks, GetSimulatedTasks_Mutable, or SetSimulatedTasks instead.

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