UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MassDebugLogging.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
7#if WITH_MASSENTITY_DEBUG
9#include "MassEntityHandle.h"
10#include "MassDebugger.h"
12#endif // WITH_MASSENTITY_DEBUG
13#include "MassDebugLogging.generated.h"
14
15
17class UObject;
18
19USTRUCT()
27
28namespace UE::Mass::Debug
29{
31 {
32#if WITH_MASSENTITY_DEBUG
35 , EntityListView(InContext.GetEntities())
37 {
38 }
39
40 inline bool ShouldLogEntity(int32 EntityIndex, FColor* OutEntityColor = nullptr) const
41 {
42#if ENABLE_VISUAL_LOG
44 && DebugFragmentsView.IsValidIndex(EntityIndex)
45 && DebugFragmentsView[EntityIndex].LogOwner != nullptr
46 && FVisualLogger::IsRecording())
47 {
48 return true;
49 }
50#endif // ENABLE_VISUAL_LOG
51 // If no actor owner or the visual logger is not recording, base it on the mass debugger
52 return EntityListView.IsValidIndex(EntityIndex)
53 && IsDebuggingEntity(EntityListView[EntityIndex], OutEntityColor);
54 }
55
56 inline const UObject* GetLogOwner(int32 EntityIndex, const UObject* FallbackOwner = nullptr) const
57 {
58 return DebugFragmentsView.IsValidIndex(EntityIndex)
59 ? DebugFragmentsView[EntityIndex].LogOwner.Get()
61 }
62
63 private:
65 const TConstArrayView<FMassEntityHandle> EntityListView;
66
70 const bool bLogEverythingWhenRecording = true;
71
72#else
73
77
78 bool ShouldLogEntity(int32 EntityIndex, FColor* OutEntityColor = nullptr) const
79 {
80 return false;
81 }
82
83 inline UObject* GetLogOwner(int32 EntityIndex, UObject* FallbackOwner = nullptr) const
84 {
85 return FallbackOwner;
86 }
87#endif // WITH_MASSENTITY_DEBUG
88 };
89}
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 UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define USTRUCT(...)
Definition ObjectMacros.h:746
Definition Object.h:95
Definition AdvancedWidgetsModule.cpp:13
Definition Color.h:486
Definition MassDebugLogging.h:21
Definition MassExecutionContext.h:29
Definition MassEntityElementTypes.h:10
Definition WeakObjectPtrTemplates.h:25
Definition MassDebugLogging.h:31
UObject * GetLogOwner(int32 EntityIndex, UObject *FallbackOwner=nullptr) const
Definition MassDebugLogging.h:83
FLoggingContext(const FMassExecutionContext &Context, bool bInCheckVisualLoggerForRecording=true)
Definition MassDebugLogging.h:74
bool ShouldLogEntity(int32 EntityIndex, FColor *OutEntityColor=nullptr) const
Definition MassDebugLogging.h:78