net.SubObjects.LogAllComparisonErrors
net.SubObjects.LogAllComparisonErrors
#Overview
name: net.SubObjects.LogAllComparisonErrors
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If enabled log all the errors detected by the CompareWithLegacy cheat. Otherwise only the first ensure triggered gets logged.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.SubObjects.LogAllComparisonErrors is to control the logging behavior of subobject comparison errors in Unreal Engine’s networking system. This setting variable is used for debugging and validation purposes within the networking subsystem, specifically for handling replicated subobjects.
This setting variable is primarily used in the Engine module, specifically within the networking-related code. It is referenced in the DataChannel.cpp file, which is part of the core networking implementation in Unreal Engine.
The value of this variable is set through a console variable (CVar) system. It is defined as a TAutoConsoleVariable with an initial value of 0, which means it’s disabled by default. Developers can change this value at runtime using console commands or through configuration files.
This variable interacts closely with another variable named CVarLogAllSubObjectComparisonErrors. They share the same value and purpose.
Developers must be aware that this variable is used for debugging purposes and may impact performance when enabled. It should be used cautiously in production environments.
Best practices for using this variable include:
- Enable it only when debugging replication issues related to subobjects.
- Be prepared for increased log output when enabled, as it will log all detected errors instead of just the first one.
- Use it in conjunction with other networking debugging tools for a comprehensive analysis.
Regarding the associated variable CVarLogAllSubObjectComparisonErrors:
This is the actual console variable that controls the behavior. It is an integer variable that, when set to a non-zero value, enables logging of all subobject comparison errors detected by the CompareWithLegacy cheat.
The variable is used in the ValidateReplicatedSubObjects function of the UActorChannel class. When enabled, it allows for more verbose logging of errors detected during the validation of replicated subobjects.
Developers should be aware that enabling this variable may result in a significant increase in log output, especially in complex scenes with many replicated objects. It should be used judiciously and primarily for debugging purposes.
Best practices for using CVarLogAllSubObjectComparisonErrors include:
- Enable it temporarily when investigating specific replication issues related to subobjects.
- Combine it with other networking diagnostic tools for a complete picture of replication behavior.
- Remember to disable it after debugging to prevent unnecessary performance overhead and log spam in production environments.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:135
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLogAllSubObjectComparisonErrors(
TEXT("net.SubObjects.LogAllComparisonErrors"),
0,
TEXT("If enabled log all the errors detected by the CompareWithLegacy cheat. Otherwise only the first ensure triggered gets logged."));
static bool GCVarDetectDeprecatedReplicateSubObjects = false;
static FAutoConsoleVariableRef CVarDetectDeprecatedReplicateSubObjects(
TEXT("net.SubObjects.DetectDeprecatedReplicatedSubObjects"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarLogAllSubObjectComparisonErrors
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:134
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
TEXT("When turned on we will collect the subobjects replicated by the ReplicateSubObjects method and compare them with the ones replicated via the Actor's registered list. If a divergence is detected it will trigger an ensure."));
static TAutoConsoleVariable<int32> CVarLogAllSubObjectComparisonErrors(
TEXT("net.SubObjects.LogAllComparisonErrors"),
0,
TEXT("If enabled log all the errors detected by the CompareWithLegacy cheat. Otherwise only the first ensure triggered gets logged."));
static bool GCVarDetectDeprecatedReplicateSubObjects = false;
static FAutoConsoleVariableRef CVarDetectDeprecatedReplicateSubObjects(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataChannel.cpp:4238
Scope (from outer to inner):
file
function bool UActorChannel::ValidateReplicatedSubObjects
Source code excerpt:
#if SUBOBJECT_TRANSITION_VALIDATION
bool bErrorDetected = false;
const bool bLogAllErrors = UE::Net::CVarLogAllSubObjectComparisonErrors.GetValueOnAnyThread() != 0;
for (int32 i=DataChannelInternal::LegacySubObjectsCollected.Num()-1; i >= 0; i--)
{
const DataChannelInternal::FSubObjectReplicatedInfo& Info = DataChannelInternal::LegacySubObjectsCollected[i];
const bool bWasFound = DataChannelInternal::ReplicatedSubObjectsTracker.RemoveSingleSwap(Info, EAllowShrinking::No) != 0;