UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GameplayTasksComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "UObject/CoreNet.h"
11#include "EngineDefines.h"
13#include "GameplayTask.h"
16#include "GameplayTasksComponent.generated.h"
17
18class AActor;
19class Error;
20class FOutBunch;
21class UActorChannel;
22
24{
25 Add,
26 Remove,
27};
28
29UENUM()
42
54
56
60UCLASS(ClassGroup = GameplayTasks, hidecategories = (Object, LOD, Lighting, Transform, Sockets, TextureStreaming), editinlinenew, meta = (BlueprintSpawnableComponent), MinimalAPI)
61class UGameplayTasksComponent : public UActorComponent, public IGameplayTaskOwnerInterface, public IVisualLoggerDebugSnapshotInterface
62{
64
66
69
71
75
78
81 {
82 return SimulatedTasks;
83 }
84
87
90
93
94 UPROPERTY()
96
102
104 UPROPERTY()
106
110
111public:
112 UPROPERTY(BlueprintReadWrite, Category = "Gameplay Tasks")
114
115 GAMEPLAYTASKS_API UGameplayTasksComponent(const FObjectInitializer& ObjectInitializer);
116
117 UFUNCTION()
119
120 GAMEPLAYTASKS_API virtual void GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const override;
121 GAMEPLAYTASKS_API virtual bool ReplicateSubobjects(UActorChannel *Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags) override;
122
123 GAMEPLAYTASKS_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
125
129
133
136
138
141
142 GAMEPLAYTASKS_API bool HasActiveTasks(UClass* TaskClass) const;
143
145
146 // BEGIN IGameplayTaskOwnerInterface
147 virtual UGameplayTasksComponent* GetGameplayTasksComponent(const UGameplayTask& Task) const { return const_cast<UGameplayTasksComponent*>(this); }
148 virtual AActor* GetGameplayTaskOwner(const UGameplayTask* Task) const override { return GetOwner(); }
149 virtual AActor* GetGameplayTaskAvatar(const UGameplayTask* Task) const override { return GetOwner(); }
152 // END IGameplayTaskOwnerInterface
153
154 // ActorComponent overrides
155 GAMEPLAYTASKS_API virtual void ReadyForReplication() override;
156
157 UFUNCTION(BlueprintCallable, DisplayName="Run Gameplay Task", meta=(ScriptName="RunGameplayTask"), Category = "Gameplay Tasks", meta = (AutoCreateRefTerm = "AdditionalRequiredResources, AdditionalClaimedResources", AdvancedDisplay = "AdditionalRequiredResources, AdditionalClaimedResources"))
159
161
162#if WITH_GAMEPLAYTASK_DEBUG
167#endif // WITH_GAMEPLAYTASK_DEBUG
168 using GameplayTaskContainerType = decltype(TickingTasks);
169 GAMEPLAYTASKS_API GameplayTaskContainerType::TConstIterator GetTickingTaskIterator() const;
170 GAMEPLAYTASKS_API GameplayTaskContainerType::TConstIterator GetKnownTaskIterator() const;
171 GAMEPLAYTASKS_API GameplayTaskContainerType::TConstIterator GetPriorityQueueIterator() const;
172 GAMEPLAYTASKS_API GameplayTaskContainerType::TConstIterator GetSimulatedTaskIterator() const;
173
174#if ENABLE_VISUAL_LOG
175 GAMEPLAYTASKS_API virtual void GrabDebugSnapshot(FVisualLogEntry* Snapshot) const override;
177#endif // ENABLE_VISUAL_LOG
178
179protected:
180 struct FEventLock
181 {
182 FEventLock(UGameplayTasksComponent* InOwner);
183 ~FEventLock();
184
185 protected:
186 UGameplayTasksComponent* Owner;
187 };
188
192
194
195private:
198
201
202 inline bool CanProcessEvents() const { return !bInEventProcessingInProgress && (EventLockCounter == 0); }
203
205
207 UPROPERTY(Transient, ReplicatedUsing = OnRep_SimulatedTasks)
209
212
213};
214
215typedef UGameplayTasksComponent::GameplayTaskContainerType::TConstIterator FConstGameplayTaskIterator;
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name)
Definition DelegateCombinations.h:62
ELevelTick
Definition EngineBaseTypes.h:70
EGameplayTaskState
Definition GameplayTask.h:23
EGameplayTaskRunResult
Definition GameplayTasksComponent.h:31
UCLASS(ClassGroup=GameplayTasks, hidecategories=(Object, LOD, Lighting, Transform, Sockets, TextureStreaming), editinlinenew, meta=(BlueprintSpawnableComponent), MinimalAPI) class UGameplayTasksComponent typedef UGameplayTasksComponent::GameplayTaskContainerType::TConstIterator FConstGameplayTaskIterator
Definition GameplayTasksComponent.h:60
EGameplayTaskEvent
Definition GameplayTasksComponent.h:24
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Actor.h:257
Definition CoreNet.h:300
Definition NameTypes.h:617
Definition UObjectGlobals.h:1292
Definition DataBunch.h:24
Definition GameplayTaskOwnerInterface.h:21
virtual void OnGameplayTaskActivated(UGameplayTask &Task)
Definition GameplayTaskOwnerInterface.h:41
virtual void OnGameplayTaskDeactivated(UGameplayTask &Task)
Definition GameplayTaskOwnerInterface.h:44
virtual AActor * GetGameplayTaskAvatar(const UGameplayTask *Task) const
Definition GameplayTaskOwnerInterface.h:32
virtual AActor * GetGameplayTaskOwner(const UGameplayTask *Task) const PURE_VIRTUAL(IGameplayTaskOwnerInterface
Definition GameplayTaskOwnerInterface.h:29
virtual UGameplayTasksComponent * GetGameplayTasksComponent(const UGameplayTask &Task) const PURE_VIRTUAL(IGameplayTaskOwnerInterface
Definition GameplayTaskOwnerInterface.h:26
Definition VisualLoggerDebugSnapshotInterface.h:17
virtual void GrabDebugSnapshot(struct FVisualLogEntry *Snapshot) const
Definition VisualLoggerDebugSnapshotInterface.h:20
Definition Sockets.Build.cs:6
Definition Array.h:670
Definition ScriptInterface.h:139
Definition SubclassOf.h:30
Definition ActorChannel.h:78
Definition ActorComponent.h:152
AActor * GetOwner() const
Definition ActorComponent.h:1534
virtual ENGINE_API void ReadyForReplication()
Definition ActorComponent.cpp:1604
Definition Class.h:3793
Definition GameplayTaskResource.h:15
Definition GameplayTask.h:146
Definition EngineBaseTypes.h:571
Definition GameplayTask.h:46
Definition GameplayTasksComponent.h:44
UGameplayTask & RelatedTask
Definition GameplayTasksComponent.h:46
EGameplayTaskEvent Event
Definition GameplayTasksComponent.h:45
FGameplayTaskEventData(EGameplayTaskEvent InEvent, UGameplayTask &InRelatedTask)
Definition GameplayTasksComponent.h:48
Definition EngineTypes.h:3601
Definition VisualLoggerTypes.h:205
Definition ObjectPtr.h:488