UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MassDebuggerBreakpoints.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "HAL/Platform.h"
6#include "MassEntityMacros.h"
7
8#if WITH_MASSENTITY_DEBUG
9#define MASS_BREAKPOINT(bShouldBreak) \
10 do { \
11 if (UNLIKELY(bShouldBreak)) \
12 { \
13 UE::Mass::Debug::FBreakpoint::DebugBreak(); \
14 } \
15 } while (0)
16
17#include "MassEntityHandle.h"
18#include "Misc/TVariant.h"
19#include "UObject/ObjectKey.h"
20#include "MassRequirements.h"
21
22struct FMassDebugger;
23class UMassProcessor;
24class UScriptStruct;
25
26namespace UE::Mass::Debug
27{
28 struct FBreakpointHandle
29 {
30 int32 Handle = 0;
31
32 FBreakpointHandle(int32 InHandle)
34 {
35 }
36
37 FBreakpointHandle() = default;
38
39 friend bool operator==(const FBreakpointHandle& A, const FBreakpointHandle& B)
40 {
41 return A.Handle == B.Handle;
42 }
43
44 bool IsValid() const
45 {
46 return Handle > 0;
47 }
48
49 operator bool() const
50 {
51 return IsValid();
52 }
53
54 static FBreakpointHandle CreateHandle()
55 {
56 static int32 LastHandle = 0;
57 return FBreakpointHandle{ ++LastHandle };
58 }
59
60 static FBreakpointHandle Invalid()
61 {
62 return FBreakpointHandle();
63 }
64 };
65
66 struct FBreakpoint
67 {
68 friend FMassDebugger;
69
70 MASSENTITY_API FBreakpoint();
71
72 enum class ETriggerType : uint8
73 {
74 None,
81 TagAdd,
83 MAX
84 };
87
88 enum class EFilterType : uint8
89 {
90 None,
93 Query
94 };
95
98
102 >;
103
104 using FilterVariant = TVariant<
107 >;
108
109 FBreakpointHandle Handle;
110 mutable uint64 HitCount = 0;
111 ETriggerType TriggerType = ETriggerType::None;
112 EFilterType FilterType = EFilterType::None;
115 bool bEnabled = false;
116
125
133 MASSENTITY_API bool ApplyEntityFilterByArchetype(const FMassArchetypeHandle& ArchetypeHandle) const;
134
143 MASSENTITY_API bool ApplyEntityFilter(const FMassEntityManager& EntityManager, const FMassEntityHandle& Entity) const;
144
154
163 template<typename... TFragments>
165 {
167 {
168 return false;
169 }
170 return (... || CheckFragmentAddBreakpoints(Handle, TFragments::StaticStruct()));
171 }
172
182
191 template<typename... TFragments>
193 {
195 {
196 return false;
197 }
198
199 return (... || CheckFragmentAddBreakpoints(Entities, TFragments::StaticStruct()));
200 }
201
210 template<typename... TFragments>
212 {
214 {
215 return false;
216 }
217 return (... || CheckFragmentAddBreakpoints(Handle, std::remove_reference_t<decltype(InFragments)>::StaticStruct()));
218 }
219
228 template<typename... TFragments>
230 {
232 {
233 return false;
234 }
235
236 return (... || CheckFragmentAddBreakpoints(Entities, std::remove_reference_t<decltype(InFragments)>::StaticStruct()));
237 }
238
248
257 template<typename... TFragments>
259 {
261 {
262 return false;
263 }
264 return (... || CheckFragmentRemoveBreakpoints(Handle, std::remove_reference_t<decltype(InFragments)>::StaticStruct()));
265 }
266
276
285 template<typename... TFragments>
287 {
289 {
290 return false;
291 }
292 return (... || CheckFragmentRemoveBreakpoints(Entities, TFragments::StaticStruct()));
293 }
294
303
311 template<typename... TFragments>
313 {
315 {
316 return false;
317 }
318
319 return CheckCreateEntityBreakpoints({ TFragments::StaticStruct()... });
320 }
321
329 static MASSENTITY_API bool CheckCreateEntityBreakpoints(const FMassArchetypeHandle& ArchetypeHandle);
330
339
348
353
359 static inline bool HasBreakpoint()
360 {
361 return bHasBreakpoint;
362 }
363
367 static MASSENTITY_API void DebugBreak();
368
369 private:
370 static bool bHasBreakpoint;
371 static FBreakpointHandle LastBreakpointHandle;
372 };
373
374} // namespace UE::Mass::Debug
375
376#else // WITH_MASSENTITY_DEBUG
377namespace UE::Mass::Debug
378{
380 {
381 };
382
384 {
385 enum class ETriggerType : uint8
386 {
387 };
388 enum class EFilterType : uint8
389 {
390 };
391 };
392}
393
394#define MASS_BREAKPOINT(...) \
395 do { } while (0)
396
397#endif // WITH_MASSENTITY_DEBUG
#define LIKELY(x)
Definition CityHash.cpp:107
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
UScriptStruct * StaticStruct()
Definition ReflectedTypeAccessors.h:18
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Array.h:670
Definition ObjectKey.h:228
Definition TVariant.h:48
Definition MassProcessor.h:78
Definition Class.h:1720
Definition MassCommandBuffer.h:52
bool operator==(const FPropertyTypeName &Lhs, const FPropertyTypeName &Rhs)
Definition PropertyTypeName.cpp:329
Definition MassArchetypeTypes.h:39
Definition MassDebugger.h:441
Definition MassEntityHandle.h:13
Definition MassEntityManager.h:96
Definition MassRequirements.h:160
Definition MassDebuggerBreakpoints.h:380
Definition MassDebuggerBreakpoints.h:384
ETriggerType
Definition MassDebuggerBreakpoints.h:386
EFilterType
Definition MassDebuggerBreakpoints.h:389