ControlRig.EnableDrawInterfaceInGame
ControlRig.EnableDrawInterfaceInGame
#Overview
name: ControlRig.EnableDrawInterfaceInGame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If nonzero debug drawing will be enabled during play.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ControlRig.EnableDrawInterfaceInGame is to enable debug drawing for the Control Rig system during gameplay. This setting variable is primarily used for performance optimization and debugging purposes in the animation system of Unreal Engine 5.
This setting variable is used within the Control Rig plugin, which is part of Unreal Engine’s animation system. Based on the callsites, it’s clear that this variable is utilized in the UControlRig class, which is a core component of the Control Rig system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, meaning debug drawing is disabled by default during gameplay for performance reasons.
The associated variable CVarControlRigEnableDrawInterfaceInGame interacts directly with ControlRig.EnableDrawInterfaceInGame. They share the same value and purpose.
Developers must be aware that enabling this variable may impact performance, especially in shipped games or during Play-In-Editor (PIE) mode. It should primarily be used for debugging purposes and not left enabled in production builds.
Best practices when using this variable include:
- Only enable it when necessary for debugging animation issues.
- Disable it before creating production builds to ensure optimal performance.
- Use it in conjunction with other debugging tools to get a comprehensive view of the Control Rig system’s behavior.
Regarding the associated variable CVarControlRigEnableDrawInterfaceInGame:
This is a console variable that directly controls the behavior defined by ControlRig.EnableDrawInterfaceInGame. It’s implemented as a TAutoConsoleVariable
The purpose of CVarControlRigEnableDrawInterfaceInGame is the same as ControlRig.EnableDrawInterfaceInGame - to enable debug drawing for the Control Rig system during gameplay.
This variable is used in the UControlRig::Execute function to determine whether debug drawing should be enabled. It’s checked only in WITH_EDITOR builds, indicating its primary use is for development and debugging rather than in shipping builds.
Developers should be aware that changing this variable at runtime will immediately affect the debug drawing behavior of the Control Rig system. They should also note that it’s only effective in editor builds due to the WITH_EDITOR conditional compilation.
Best practices for using CVarControlRigEnableDrawInterfaceInGame include:
- Use console commands to toggle it on/off during gameplay for real-time debugging.
- Remember to disable it when performance testing, as it can impact frame rates.
- Consider creating editor utilities or debugging tools that can toggle this variable easily for the development team.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/ControlRig.cpp:62
Scope: file
Source code excerpt:
//By default we don't for performance
static TAutoConsoleVariable<float> CVarControlRigEnableDrawInterfaceInGame(
TEXT("ControlRig.EnableDrawInterfaceInGame"),
0,
TEXT("If nonzero debug drawing will be enabled during play."),
ECVF_Default);
UControlRig::UControlRig(const FObjectInitializer& ObjectInitializer)
#Associated Variable and Callsites
This variable is associated with another variable named CVarControlRigEnableDrawInterfaceInGame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/ControlRig.cpp:61
Scope: file
Source code excerpt:
//CVar to specify if we should allow debug drawing in game (during shipped game or PIE)
//By default we don't for performance
static TAutoConsoleVariable<float> CVarControlRigEnableDrawInterfaceInGame(
TEXT("ControlRig.EnableDrawInterfaceInGame"),
0,
TEXT("If nonzero debug drawing will be enabled during play."),
ECVF_Default);
#Loc: <Workspace>/Engine/Plugins/Animation/ControlRig/Source/ControlRig/Private/ControlRig.cpp:786
Scope (from outer to inner):
file
function bool UControlRig::Execute
Source code excerpt:
bool bEnableDrawInterface = false;
#if WITH_EDITOR
const bool bEnabledDuringGame = CVarControlRigEnableDrawInterfaceInGame->GetInt() != 0;
const bool bInGame = !(GEditor && !GEditor->GetPIEWorldContext());
if (bEnabledDuringGame || !bInGame)
{
bEnableDrawInterface = true;
}
#endif