net.DebugDrawCullDistance
net.DebugDrawCullDistance
#Overview
name: net.DebugDrawCullDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Cull distance for net.DebugDraw. World UnitsMax world units an actor can be away from the local view to draw its dormancy status. Zero disables culling
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.DebugDrawCullDistance is to control the cull distance for network debug drawing in Unreal Engine 5. It sets the maximum distance at which network-related debug information will be rendered in the game world.
This setting variable is primarily used by the networking subsystem of Unreal Engine, specifically within the NetDriver module. Based on the callsites, it’s clear that this variable is utilized in the context of debug drawing for network-related information.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 0.0f, which means culling is disabled by default.
The associated variable CVarNetDebugDrawCullDistance directly interacts with net.DebugDrawCullDistance. They share the same value and purpose, with CVarNetDebugDrawCullDistance being the C++ representation of the console variable.
Developers must be aware that:
- This variable is measured in world units.
- A value of zero disables culling, meaning all network debug information will be drawn regardless of distance.
- This setting only affects debug drawing and has no impact on actual network performance or behavior.
Best practices when using this variable include:
- Use it primarily for debugging and development purposes, not in shipping builds.
- Adjust the value based on the scale of your game world to find a balance between visibility and performance.
- Remember to disable or set to zero when you need to see all network debug information, regardless of distance.
Regarding the associated variable CVarNetDebugDrawCullDistance:
The purpose of CVarNetDebugDrawCullDistance is to provide C++ code access to the net.DebugDrawCullDistance console variable. It’s used within the engine code to retrieve the current cull distance value for network debug drawing.
This variable is part of the NetDriver module in the Engine subsystem. It’s used directly in the DrawNetDriverDebug function to determine which actors’ network states should be visually represented.
The value of CVarNetDebugDrawCullDistance is set automatically by the console variable system when net.DebugDrawCullDistance is modified.
CVarNetDebugDrawCullDistance interacts directly with net.DebugDrawCullDistance, effectively serving as its C++ interface.
Developers should be aware that:
- This variable is used in actual engine code, not just for console commands.
- Changes to net.DebugDrawCullDistance will be reflected in CVarNetDebugDrawCullDistance.
Best practices for using CVarNetDebugDrawCullDistance include:
- Use GetValueOnAnyThread() to safely access its value from any thread.
- Remember that modifying this variable directly won’t change the console variable; always modify net.DebugDrawCullDistance instead.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:383
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarNetDebugDrawCullDistance(
TEXT("net.DebugDrawCullDistance"),
0.f,
TEXT("Cull distance for net.DebugDraw. World Units")
TEXT("Max world units an actor can be away from the local view to draw its dormancy status. Zero disables culling"),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarUseAdaptiveNetUpdateFrequency(
#Associated Variable and Callsites
This variable is associated with another variable named CVarNetDebugDrawCullDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:382
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<float> CVarNetDebugDrawCullDistance(
TEXT("net.DebugDrawCullDistance"),
0.f,
TEXT("Cull distance for net.DebugDraw. World Units")
TEXT("Max world units an actor can be away from the local view to draw its dormancy status. Zero disables culling"),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:6187
Scope (from outer to inner):
file
function void UNetDriver::DrawNetDriverDebug
Source code excerpt:
}
const float MaxDebugDrawDistanceSquare = FMath::Square(CVarNetDebugDrawCullDistance.GetValueOnAnyThread());
const FVector Extent(20.f);
// Used to draw additional boxes to show more state
const FBox BoxExpansion = FBox(&Extent, 1);
#if UE_WITH_IRIS