net.Replication.DebugProperty

net.Replication.DebugProperty

#Overview

name: net.Replication.DebugProperty

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.Replication.DebugProperty is to debug the replication of properties in Unreal Engine’s networking system. This console variable allows developers to specify a partial property name to focus debugging efforts on specific properties during network replication.

This setting variable is primarily used by the networking subsystem of Unreal Engine, specifically the replication system. It’s referenced in the Engine module, within the DataReplication.cpp file, which handles property replication across the network.

The value of this variable is set through the console or configuration files. It’s implemented as a TAutoConsoleVariable, which means it can be changed at runtime through console commands.

The associated variable CVarNetReplicationDebugProperty directly interacts with net.Replication.DebugProperty. They share the same value and purpose.

Developers must be aware that this variable is intended for debugging purposes only and should not be used in shipping builds. It’s conditionally compiled out in shipping and test builds.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Set it to partial property names to narrow down the debugging focus.
  3. Be aware that enabling this debug feature may impact performance, so use it judiciously.
  4. Clear the value when not actively debugging to avoid unnecessary overhead.

Regarding the associated variable CVarNetReplicationDebugProperty:

The purpose of CVarNetReplicationDebugProperty is to provide programmatic access to the net.Replication.DebugProperty console variable within the C++ code.

It’s used in the same Engine module and DataReplication.cpp file as net.Replication.DebugProperty.

The value is set automatically by the console variable system when net.Replication.DebugProperty is modified.

It interacts directly with net.Replication.DebugProperty, essentially serving as its C++ representation.

Developers should be aware that this variable is used to retrieve the current value of the debug property in the code, particularly within conditional compilation blocks for non-shipping builds.

Best practices include using GetValueOnAnyThread() to safely access the value from any thread, and checking if the returned string is empty before using it in comparisons.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:47

Scope: file

Source code excerpt:


static TAutoConsoleVariable<FString> CVarNetReplicationDebugProperty(
	TEXT("net.Replication.DebugProperty"),
	TEXT(""),
	TEXT("Debugs Replication of property by name, ")
	TEXT("this should be set to the partial name of the property to debug"),
	ECVF_Default);

int32 GNetRPCDebug = 0;

#Associated Variable and Callsites

This variable is associated with another variable named CVarNetReplicationDebugProperty. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:46

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<FString> CVarNetReplicationDebugProperty(
	TEXT("net.Replication.DebugProperty"),
	TEXT(""),
	TEXT("Debugs Replication of property by name, ")
	TEXT("this should be set to the partial name of the property to debug"),
	ECVF_Default);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DataReplication.cpp:1111

Scope (from outer to inner):

file
function     bool FObjectReplicator::ReceivedBunch

Source code excerpt:

#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
			{
				FString DebugPropertyStr = CVarNetReplicationDebugProperty.GetValueOnAnyThread();
				if (!DebugPropertyStr.IsEmpty() && ReplicatedProp->GetName().Contains(DebugPropertyStr))
				{
					UE_LOG(LogRep, Log, TEXT("Replicating Property[%d] %s on %s"), ReplicatedProp->RepIndex, *ReplicatedProp->GetName(), *Object->GetName());
				}
			}
#endif