ai.crowd.DebugSelectedActors
ai.crowd.DebugSelectedActors
#Overview
name: ai.crowd.DebugSelectedActors
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable debug drawing for selected crowd agent.\n0: Disable, 1: Enable
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ai.crowd.DebugSelectedActors is to enable debug drawing for selected crowd agents in the Unreal Engine’s AI module, specifically within the crowd simulation system.
This setting variable is primarily used by the AI module, particularly in the crowd management and navigation subsystem. Based on the callsites, it’s clear that this variable is utilized within the CrowdManager.cpp file, which is part of the AIModule.
The value of this variable is set through a console variable (cvar) system. It’s initialized to 0 and can be changed at runtime using the console command “ai.crowd.DebugSelectedActors”.
The associated variable DebugSelectedActors interacts directly with ai.crowd.DebugSelectedActors. They share the same value, with DebugSelectedActors being the actual int32 variable used in the code, while ai.crowd.DebugSelectedActors is the console variable name used to manipulate it.
Developers must be aware that this is a debugging feature. When enabled (set to 1), it will cause additional processing and drawing operations, which may impact performance. Therefore, it should be used judiciously, primarily during development and debugging phases.
Best practices when using this variable include:
- Only enable it when actively debugging crowd agent behavior.
- Disable it in release builds or when performance is a concern.
- Use it in conjunction with other debugging tools and variables (like DebugVisLog) for a comprehensive view of crowd agent behavior.
- Be aware that it only affects selected agents, so ensure the correct agents are selected when using this feature.
Regarding the associated variable DebugSelectedActors:
- It’s an int32 variable used internally in the code to store the state of the debug drawing feature.
- It’s directly manipulated by the console variable system.
- When this variable is true (non-zero), debug drawing for selected crowd agents is enabled.
- It’s used in conditional statements to determine whether to perform debug drawing operations, as seen in the DebugTick function of the UCrowdManager class.
Developers should treat DebugSelectedActors as a read-only variable within their code, relying on the console variable system to modify its value rather than changing it directly.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:44
Scope (from outer to inner):
file
namespace FCrowdDebug
Source code excerpt:
/** if set, debug information will be displayed for agent selected in editor */
int32 DebugSelectedActors = 0;
FAutoConsoleVariableRef CVarDebugSelectedActors(TEXT("ai.crowd.DebugSelectedActors"), DebugSelectedActors,
TEXT("Enable debug drawing for selected crowd agent.\n0: Disable, 1: Enable"), ECVF_Default);
/** if set, basic debug information will be recorded in VisLog for all agents */
int32 DebugVisLog = 0;
FAutoConsoleVariableRef CVarDebugVisLog(TEXT("ai.crowd.DebugVisLog"), DebugVisLog,
TEXT("Enable detailed vislog recording for all crowd agents.\n0: Disable, 1: Enable"), ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named DebugSelectedActors
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:43
Scope (from outer to inner):
file
namespace FCrowdDebug
Source code excerpt:
{
/** if set, debug information will be displayed for agent selected in editor */
int32 DebugSelectedActors = 0;
FAutoConsoleVariableRef CVarDebugSelectedActors(TEXT("ai.crowd.DebugSelectedActors"), DebugSelectedActors,
TEXT("Enable debug drawing for selected crowd agent.\n0: Disable, 1: Enable"), ECVF_Default);
/** if set, basic debug information will be recorded in VisLog for all agents */
int32 DebugVisLog = 0;
FAutoConsoleVariableRef CVarDebugVisLog(TEXT("ai.crowd.DebugVisLog"), DebugVisLog,
TEXT("Enable detailed vislog recording for all crowd agents.\n0: Disable, 1: Enable"), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:1173
Scope (from outer to inner):
file
function void UCrowdManager::DebugTick
Source code excerpt:
// on screen debugging
const dtCrowdAgent* SelectedAgent = DetourAgentDebug->idx >= 0 ? DetourCrowd->getAgent(DetourAgentDebug->idx) : NULL;
if (SelectedAgent && FCrowdDebug::DebugSelectedActors)
{
if (FCrowdDebug::DrawDebugCorners)
{
DrawDebugCorners(SelectedAgent);
}