UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GameplayDebuggerTypes.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"
10#include "GameplayDebuggerTypes.generated.h"
11
12class FCanvasItem;
13class UCanvas;
14class UFont;
15struct FCanvasIcon;
17class UWorld;
18
20
21class FCanvasItem;
22struct FCanvasIcon;
23
25{
27}
28
30{
31public:
34
37
40
43
46
49
52
55
56 // print string on canvas
57 GAMEPLAYDEBUGGER_API void Print(const FString& String);
58 GAMEPLAYDEBUGGER_API void Print(const FColor& Color, const FString& String);
59 GAMEPLAYDEBUGGER_API void Print(const FColor& Color, const float Alpha, const FString& String);
60 GAMEPLAYDEBUGGER_API void PrintAt(float PosX, float PosY, const FString& String);
61 GAMEPLAYDEBUGGER_API void PrintAt(float PosX, float PosY, const FColor& Color, const FString& String);
62 GAMEPLAYDEBUGGER_API void PrintAt(float PosX, float PosY, const FColor& Color, const float Alpha, const FString& String);
63
64 // print formatted string on canvas
65 template <typename FmtType, typename... Types>
66 void Printf(const FmtType& Fmt, Types... Args)
67 {
68 static_assert(TIsArrayOrRefOfTypeByPredicate<FmtType, TIsCharEncodingCompatibleWithTCHAR>::Value, "Formatting string must be a TCHAR array.");
69 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FGameplayDebuggerCanvasContext::Printf");
70
71 PrintfImpl(FColor::White, 1.0f, (const TCHAR*)Fmt, Args...);
72 }
73
74 template <typename FmtType, typename... Types>
75 void Printf(const FColor& Color, const FmtType& Fmt, Types... Args)
76 {
77 static_assert(TIsArrayOrRefOfTypeByPredicate<FmtType, TIsCharEncodingCompatibleWithTCHAR>::Value, "Formatting string must be a TCHAR array.");
78 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FGameplayDebuggerCanvasContext::Printf");
79
80 PrintfImpl(Color, 1.0f, (const TCHAR*)Fmt, Args...);
81 }
82
83 template <typename FmtType, typename... Types>
84 void Printf(const FColor& Color, const float Alpha, const FmtType& Fmt, Types... Args)
85 {
86 static_assert(TIsArrayOrRefOfTypeByPredicate<FmtType, TIsCharEncodingCompatibleWithTCHAR>::Value, "Formatting string must be a TCHAR array.");
87 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FGameplayDebuggerCanvasContext::Printf");
88
89 PrintfImpl(Color, Alpha, (const TCHAR*)Fmt, Args...);
90 }
91
92 template <typename FmtType, typename... Types>
93 void PrintfAt(float PosX, float PosY, const FmtType& Fmt, Types... Args)
94 {
95 static_assert(TIsArrayOrRefOfTypeByPredicate<FmtType, TIsCharEncodingCompatibleWithTCHAR>::Value, "Formatting string must be a TCHAR array.");
96 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FGameplayDebuggerCanvasContext::PrintfAt");
97
98 PrintfAtImpl(PosX, PosY, FColor::White, 1.0f, (const TCHAR*)Fmt, Args...);
99 }
100
101 template <typename FmtType, typename... Types>
102 void PrintfAt(float PosX, float PosY, const FColor& Color, const FmtType& Fmt, Types... Args)
103 {
104 static_assert(TIsArrayOrRefOfTypeByPredicate<FmtType, TIsCharEncodingCompatibleWithTCHAR>::Value, "Formatting string must be a TCHAR array.");
105 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FGameplayDebuggerCanvasContext::PrintfAt");
106
107 PrintfAtImpl(PosX, PosY, Color, 1.0f, (const TCHAR*)Fmt, Args...);
108 }
109
110 template <typename FmtType, typename... Types>
111 void PrintfAt(float PosX, float PosY, const FColor& Color, const float Alpha, const FmtType& Fmt, Types... Args)
112 {
113 static_assert(TIsArrayOrRefOfTypeByPredicate<FmtType, TIsCharEncodingCompatibleWithTCHAR>::Value, "Formatting string must be a TCHAR array.");
114 static_assert((TIsValidVariadicFunctionArg<Types>::Value && ...), "Invalid argument(s) passed to FGameplayDebuggerCanvasContext::PrintfAt");
115
116 PrintfAtImpl(PosX, PosY, Color, Alpha, (const TCHAR*)Fmt, Args...);
117 }
118
119private:
120 GAMEPLAYDEBUGGER_API void VARARGS PrintfImpl(const FColor& Color, const float Alpha, const TCHAR* Args, ...);
121 GAMEPLAYDEBUGGER_API void VARARGS PrintfAtImpl(float PosX, float PosY, const FColor& Color, const float Alpha, const TCHAR* Args, ...);
122
123public:
124 // moves cursor to new line
126
127 // calculate size of string
128 GAMEPLAYDEBUGGER_API void MeasureString(const FString& String, float& OutSizeX, float& OutSizeY) const;
129
130 // get height of single line text
132
133 // project world location on canvas
135
136 // check if world location is visible in current view
137 GAMEPLAYDEBUGGER_API bool IsLocationVisible(const FVector& Location) const;
138
139 // draw item on canvas
140 GAMEPLAYDEBUGGER_API void DrawItem(FCanvasItem& Item, float PosX, float PosY);
141
142 // draw icon on canvas
143 GAMEPLAYDEBUGGER_API void DrawIcon(const FColor& Color, const FCanvasIcon& Icon, float PosX, float PosY, float Scale = 1.f);
144
145 // fetches the World associated with this context. Will use the World member variable, if set, and
146 // PlayerController's world otherwise. Note that it can still be null and needs to be tested.
148};
149
151{
152 static FString ColorNameInput = TEXT("white");
153 static FString ColorNameEnabled = TEXT("green");
154 static FString ColorNameDisabled = TEXT("grey");
155 static FString ColorNameEnabledActiveRow = TEXT("green");
156 static FString ColorNameDisabledActiveRow = TEXT("black");
157
158 static FString Separator = TEXT("{white} | ");
159 static FString SeparatorSpace = TEXT(" ");
160}
161
162UENUM()
164{
165 Invalid,
166 Point,
167 Segment,
168 Box,
169 Cone,
170 Cylinder,
171 Circle,
172 Rectangle,
173 Capsule,
174 Polygon,
175 Polyline,
176 Arrow,
177};
178
179USTRUCT()
181{
183
184
185 UPROPERTY()
186 TArray<FVector> ShapeData;
187
189 UPROPERTY()
190 FString Description;
191
193 UPROPERTY()
195
197 UPROPERTY()
199
201
203 {
204 return (Type == Other.Type) && (Color == Other.Color) && (Description == Other.Description) && (ShapeData == Other.ShapeData);
205 }
206
207 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakePoint(const FVector& Location, const float Radius, const FColor& Color, const FString& Description = FString());
208 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeSegment(const FVector& StartLocation, const FVector& EndLocation, const float Thickness, const FColor& Color, const FString& Description = FString());
209 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeSegment(const FVector& StartLocation, const FVector& EndLocation, const FColor& Color, const FString& Description = FString());
210 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeArrow(const FVector& StartLocation, const FVector& EndLocation, const float HeadSize, const float Thickness, const FColor& Color, const FString& Description = FString());
211 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeBox(const FVector& Center, const FVector& Extent, const FColor& Color, const FString& Description = FString());
212 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeBox(const FVector& Center, const FVector& Extent, const float Thickness, const FColor& Color, const FString& Description = FString());
213 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeBox(const FVector& Center, const FRotator& Rotation, const FVector& Extent, const FColor& Color, const FString& Description = FString());
214 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeBox(const FVector& Center, const FRotator& Rotation, const FVector& Extent, const float Thickness, const FColor& Color, const FString& Description = FString());
215 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCone(const FVector& Location, const FVector& Direction, const float Length, const FColor& Color, const FString& Description = FString());
216 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCylinder(const FVector& Center, const float Radius, const float HalfHeight, const FColor& Color, const FString& Description = FString());
217 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCircle(const FVector& Center, const FVector& Up, const float Radius, const FColor& Color, const FString& Description = FString());
218 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCircle(const FVector& Center, const FVector& Up, const float Radius, const float Thickness, const FColor& Color, const FString& Description = FString());
219 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCircle(const FVector& Center, const FVector& WidthAxis, const FVector& HeightAxis, const float Radius, const FColor& Color, const FString& Description = FString());
220 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCircle(const FVector& Center, const FVector& WidthAxis, const FVector& HeightAxis, const float Radius, const float Thickness, const FColor& Color, const FString& Description = FString());
221 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeRectangle(const FVector& Center, const FVector& WidthAxis, const FVector& HeightAxis, const float Width, const float Height, const FColor& Color, const FString& Description = FString());
222 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeRectangle(const FVector& Center, const FVector& WidthAxis, const FVector& HeightAxis, const float Width, const float Height, const float Thickness, const FColor& Color, const FString& Description = FString());
223 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCapsule(const FVector& Center, const float Radius, const float HalfHeight, const FColor& Color, const FString& Description = FString());
224 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeCapsule(const FVector& Center, const FRotator& Rotation, const float Radius, const float HalfHeight, const FColor& Color, const FString& Description = FString());
225 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakePolygon(TConstArrayView<FVector> Verts, const FColor& Color, const FString& Description = FString());
226 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakePolyline(const TConstArrayView<FVector> Verts, const float Thickness, const FColor& Color, const FString& Description = FString());
227 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakePolyline(const TConstArrayView<FVector> Verts, const FColor& Color, const FString& Description = FString());
228 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeSegmentList(const TConstArrayView<FVector> Verts, const float Thickness, const FColor& Color, const FString& Description = FString());
229 static GAMEPLAYDEBUGGER_API FGameplayDebuggerShape MakeSegmentList(const TConstArrayView<FVector> Verts, const FColor& Color, const FString& Description = FString());
230
232};
233
235
242
243USTRUCT()
245{
247
248
249 UPROPERTY()
250 int16 DataVersion;
251
253 UPROPERTY()
254 int16 SyncCounter;
255
257 UPROPERTY()
259
261 UPROPERTY()
262 int32 DataOffset;
263
265 UPROPERTY()
266 uint32 bIsCompressed : 1;
267
268 FGameplayDebuggerDataPackHeader() : DataVersion(0), SyncCounter(0), DataSize(0), DataOffset(0), bIsCompressed(false) {}
269
271 {
272 return (DataVersion == Other.DataVersion) && (DataSize == Other.DataSize) && (DataOffset == Other.DataOffset);
273 }
274
276 {
277 return Equals(Other);
278 }
279
281 {
282 return !Equals(Other);
283 }
284};
285
350
352{
353 // input handler is called on local category
354 Local,
355
356 // input handler is replicated to authority category and called there
358};
359
383
398
#define VARARGS
Definition AndroidPlatform.h:134
EForceInit
Definition CoreMiscDefines.h:154
@ ForceInit
Definition CoreMiscDefines.h:155
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
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
return true
Definition ExternalRpcRegistry.cpp:601
EGameplayDebuggerInputMode
Definition GameplayDebuggerTypes.h:352
FArchive & operator<<(FArchive &Ar, FGameplayDebuggerShape &Shape)
Definition GameplayDebuggerTypes.cpp:410
EGameplayDebuggerDataPack
Definition GameplayDebuggerTypes.h:237
EGameplayDebuggerShape
Definition GameplayDebuggerTypes.h:164
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition PlayerController.h:261
Definition Archive.h:1208
Definition CanvasItem.h:25
Definition GameplayDebuggerTypes.h:30
GAMEPLAYDEBUGGER_API void DrawIcon(const FColor &Color, const FCanvasIcon &Icon, float PosX, float PosY, float Scale=1.f)
Definition GameplayDebuggerTypes.cpp:747
GAMEPLAYDEBUGGER_API float GetLineHeight() const
Definition GameplayDebuggerTypes.cpp:721
GAMEPLAYDEBUGGER_API void DrawItem(FCanvasItem &Item, float PosX, float PosY)
Definition GameplayDebuggerTypes.cpp:738
void Printf(const FmtType &Fmt, Types... Args)
Definition GameplayDebuggerTypes.h:66
TWeakObjectPtr< UCanvas > Canvas
Definition GameplayDebuggerTypes.h:33
void PrintfAt(float PosX, float PosY, const FColor &Color, const float Alpha, const FmtType &Fmt, Types... Args)
Definition GameplayDebuggerTypes.h:111
TWeakObjectPtr< UWorld > World
Definition GameplayDebuggerTypes.h:42
GAMEPLAYDEBUGGER_API bool IsLocationVisible(const FVector &Location) const
Definition GameplayDebuggerTypes.cpp:733
float DefaultY
Definition GameplayDebuggerTypes.h:51
FFontRenderInfo FontRenderInfo
Definition GameplayDebuggerTypes.h:45
GAMEPLAYDEBUGGER_API UWorld * GetWorld() const
Definition GameplayDebuggerTypes.cpp:757
FGameplayDebuggerCanvasContext()
Definition GameplayDebuggerTypes.h:53
GAMEPLAYDEBUGGER_API void Print(const FString &String)
Definition GameplayDebuggerTypes.cpp:586
void Printf(const FColor &Color, const FmtType &Fmt, Types... Args)
Definition GameplayDebuggerTypes.h:75
GAMEPLAYDEBUGGER_API void MeasureString(const FString &String, float &OutSizeX, float &OutSizeY) const
Definition GameplayDebuggerTypes.cpp:682
float CursorX
Definition GameplayDebuggerTypes.h:48
GAMEPLAYDEBUGGER_API FVector2D ProjectLocation(const FVector &Location) const
Definition GameplayDebuggerTypes.cpp:727
float DefaultX
Definition GameplayDebuggerTypes.h:51
void PrintfAt(float PosX, float PosY, const FmtType &Fmt, Types... Args)
Definition GameplayDebuggerTypes.h:93
GAMEPLAYDEBUGGER_API void MoveToNewLine()
Definition GameplayDebuggerTypes.cpp:675
TWeakObjectPtr< UFont > Font
Definition GameplayDebuggerTypes.h:36
void PrintfAt(float PosX, float PosY, const FColor &Color, const FmtType &Fmt, Types... Args)
Definition GameplayDebuggerTypes.h:102
float CursorY
Definition GameplayDebuggerTypes.h:48
GAMEPLAYDEBUGGER_API void PrintAt(float PosX, float PosY, const FString &String)
Definition GameplayDebuggerTypes.cpp:639
TWeakObjectPtr< APlayerController > PlayerController
Definition GameplayDebuggerTypes.h:39
void Printf(const FColor &Color, const float Alpha, const FmtType &Fmt, Types... Args)
Definition GameplayDebuggerTypes.h:84
Definition NameTypes.h:617
Definition Array.h:670
Definition Canvas.h:159
Definition Font.h:111
Definition World.h:918
Definition GameplayDebuggerTypes.h:151
Definition GameplayDebuggerTypes.cpp:22
bool IsAuthority(UWorld *World)
Definition GameplayDebuggerTypes.cpp:23
@ false
Definition radaudio_common.h:23
Definition Canvas.h:23
Definition Color.h:486
static CORE_API const FColor White
Definition Color.h:749
Definition EngineTypes.h:4090
Definition GameplayDebuggerTypes.h:245
int32 DataSize
Definition GameplayDebuggerTypes.h:258
bool operator!=(const FGameplayDebuggerDataPackHeader &Other) const
Definition GameplayDebuggerTypes.h:280
bool operator==(const FGameplayDebuggerDataPackHeader &Other) const
Definition GameplayDebuggerTypes.h:275
bool Equals(const FGameplayDebuggerDataPackHeader &Other) const
Definition GameplayDebuggerTypes.h:270
int32 DataOffset
Definition GameplayDebuggerTypes.h:262
Definition GameplayDebuggerTypes.h:287
FOnSerialize SerializeDelegate
Definition GameplayDebuggerTypes.h:323
uint32 bReceived
Definition GameplayDebuggerTypes.h:317
TArray< uint8 > Data
Definition GameplayDebuggerTypes.h:299
uint32 DataCRC
Definition GameplayDebuggerTypes.h:308
FOnReset ResetDelegate
Definition GameplayDebuggerTypes.h:322
static GAMEPLAYDEBUGGER_API int32 PacketSize
Definition GameplayDebuggerTypes.h:325
bool IsInProgress() const
Definition GameplayDebuggerTypes.h:340
int32 PackId
Definition GameplayDebuggerTypes.h:305
GAMEPLAYDEBUGGER_API void OnPacketRequest(int16 DataVersion, int32 DataOffset)
Definition GameplayDebuggerTypes.cpp:876
GAMEPLAYDEBUGGER_API bool CheckDirtyAndUpdate()
Definition GameplayDebuggerTypes.cpp:769
GAMEPLAYDEBUGGER_API bool RequestReplication(int16 SyncCounter)
Definition GameplayDebuggerTypes.cpp:785
DECLARE_DELEGATE_OneParam(FOnSerialize, FArchive &)
float GetProgress() const
Definition GameplayDebuggerTypes.h:334
EGameplayDebuggerDataPack Flags
Definition GameplayDebuggerTypes.h:320
uint32 bIsDirty
Definition GameplayDebuggerTypes.h:311
GAMEPLAYDEBUGGER_API void OnReplicated()
Definition GameplayDebuggerTypes.cpp:840
static bool IsMultiPacket(int32 TestSize)
Definition GameplayDebuggerTypes.h:345
FHeader Header
Definition GameplayDebuggerTypes.h:302
FGameplayDebuggerDataPack()
Definition GameplayDebuggerTypes.h:293
uint32 bNeedsConfirmation
Definition GameplayDebuggerTypes.h:314
Definition GameplayDebuggerTypes.h:405
FName KeyName
Definition GameplayDebuggerTypes.h:406
FGameplayDebuggerInputHandlerConfig()
Definition GameplayDebuggerTypes.h:409
static GAMEPLAYDEBUGGER_API FName CurrentExtensionName
Definition GameplayDebuggerTypes.h:414
static GAMEPLAYDEBUGGER_API FName CurrentCategoryName
Definition GameplayDebuggerTypes.h:413
FGameplayDebuggerInputModifier Modifier
Definition GameplayDebuggerTypes.h:407
Definition GameplayDebuggerTypes.h:385
FGameplayDebuggerInputHandler()
Definition GameplayDebuggerTypes.h:393
EGameplayDebuggerInputMode Mode
Definition GameplayDebuggerTypes.h:391
FGameplayDebuggerInputModifier Modifier
Definition GameplayDebuggerTypes.h:389
GAMEPLAYDEBUGGER_API FString ToString() const
Definition GameplayDebuggerTypes.cpp:913
FName KeyName
Definition GameplayDebuggerTypes.h:388
GAMEPLAYDEBUGGER_API bool IsValid() const
Definition GameplayDebuggerTypes.cpp:908
FHandler Delegate
Definition GameplayDebuggerTypes.h:390
Definition GameplayDebuggerTypes.h:361
FGameplayDebuggerInputModifier operator+(const FGameplayDebuggerInputModifier &Other) const
Definition GameplayDebuggerTypes.h:372
uint32 bCmd
Definition GameplayDebuggerTypes.h:365
uint32 bReleased
Definition GameplayDebuggerTypes.h:367
static GAMEPLAYDEBUGGER_API FGameplayDebuggerInputModifier Cmd
Definition GameplayDebuggerTypes.h:380
uint32 bCtrl
Definition GameplayDebuggerTypes.h:363
uint32 bShift
Definition GameplayDebuggerTypes.h:362
static GAMEPLAYDEBUGGER_API FGameplayDebuggerInputModifier None
Definition GameplayDebuggerTypes.h:381
uint32 bAlt
Definition GameplayDebuggerTypes.h:364
static GAMEPLAYDEBUGGER_API FGameplayDebuggerInputModifier Alt
Definition GameplayDebuggerTypes.h:379
FGameplayDebuggerInputModifier()
Definition GameplayDebuggerTypes.h:369
static GAMEPLAYDEBUGGER_API FGameplayDebuggerInputModifier Shift
Definition GameplayDebuggerTypes.h:377
FGameplayDebuggerInputModifier(bool bInShift, bool bInCtrl, bool bInAlt, bool bInCmd)
Definition GameplayDebuggerTypes.h:370
static GAMEPLAYDEBUGGER_API FGameplayDebuggerInputModifier Ctrl
Definition GameplayDebuggerTypes.h:378
uint32 bPressed
Definition GameplayDebuggerTypes.h:366
Definition GameplayDebuggerTypes.h:181
bool operator==(const FGameplayDebuggerShape &Other) const
Definition GameplayDebuggerTypes.h:202
Definition IsArrayOrRefOfTypeByPredicate.h:13
Definition IsValidVariadicFunctionArg.h:14
Definition WeakObjectPtrTemplates.h:25