net.PackageMap.DebugObject

net.PackageMap.DebugObject

#Overview

name: net.PackageMap.DebugObject

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.PackageMap.DebugObject is to debug the PackageMap serialization of specific objects in Unreal Engine’s networking system. This setting variable is used as a debugging tool to help developers track and analyze the serialization process of networked objects.

This setting variable is primarily used by the networking subsystem of Unreal Engine, specifically within the PackageMap and NetDriver modules. It’s referenced in the Core, Engine, and PackageMapClient components of the engine.

The value of this variable is set through the console or configuration files. It’s defined as a TAutoConsoleVariable of type FString, which means it can be set to a string value representing a partial name of an object to debug.

This variable interacts with another debug variable, net.PackageMap.DebugAll. Together, they provide different levels of debugging granularity for object serialization.

Developers must be aware that this variable is only active in non-shipping and non-test builds. It’s specifically designed for development and debugging purposes and should not be used in production environments.

Best practices when using this variable include:

  1. Use it sparingly and only when debugging specific networking issues related to object serialization.
  2. Set it to a partial name of the object you want to debug to narrow down the focus.
  3. Be aware that enabling this debug option may impact performance, so use it judiciously.
  4. Remember to disable it after debugging to avoid unnecessary logging or performance overhead.
  5. Use it in conjunction with net.PackageMap.DebugAll for more comprehensive debugging when necessary.

When this variable is set, it will trigger additional logging for the serialization of objects whose names contain the specified string, providing valuable information for diagnosing networking-related issues in Unreal Engine games.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3807

Scope: file

Source code excerpt:


static TAutoConsoleVariable<FString> CVarNetPackageMapDebugObject(
	TEXT("net.PackageMap.DebugObject"),
	TEXT(""),
	TEXT("Debugs PackageMap serialization of object"
		 "Partial name of object to debug"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarNetMontageDebug(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:5297

Scope (from outer to inner):

file
function     int32 UNetDriver::ServerReplicateActors_ProcessPrioritizedActorsRange

Source code excerpt:


#if !( UE_BUILD_SHIPPING || UE_BUILD_TEST )
		static IConsoleVariable* DebugObjectCvar = IConsoleManager::Get().FindConsoleVariable( TEXT( "net.PackageMap.DebugObject" ) );
		static IConsoleVariable* DebugAllObjectsCvar = IConsoleManager::Get().FindConsoleVariable( TEXT( "net.PackageMap.DebugAll" ) );
		if ( ActorInfo &&
			 ( ( DebugObjectCvar && !DebugObjectCvar->GetString().IsEmpty() && ActorInfo->Actor->GetName().Contains( DebugObjectCvar->GetString() ) ) ||
			   ( DebugAllObjectsCvar && DebugAllObjectsCvar->GetInt() != 0 ) ) )
		{
			UE_LOG( LogNetPackageMap, Log, TEXT( "Evaluating actor for replication %s" ), *ActorInfo->Actor->GetName() );

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PackageMapClient.cpp:288

Scope (from outer to inner):

file
function     bool UPackageMapClient::SerializeObject

Source code excerpt:

	
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	static IConsoleVariable* DebugObjectCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("net.PackageMap.DebugObject"));
	static IConsoleVariable* DebugAllObjectsCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("net.PackageMap.DebugAll"));
	if (Object &&
		((DebugObjectCvar && !DebugObjectCvar->GetString().IsEmpty() && Object->GetName().Contains(DebugObjectCvar->GetString())) ||
		(DebugAllObjectsCvar && DebugAllObjectsCvar->GetInt() != 0)))
	{
		UE_LOG(LogNetPackageMap, Log, TEXT("Serialized Object %s"), *Object->GetName());