ts.debug.EnableTargetingDebugging

ts.debug.EnableTargetingDebugging

#Overview

name: ts.debug.EnableTargetingDebugging

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 ts.debug.EnableTargetingDebugging is to enable or disable debugging mode for the targeting system in Unreal Engine 5. This setting variable is specifically designed for debugging and development purposes within the Gameplay Targeting System.

This setting variable is primarily used by the Gameplay Targeting System plugin, which is an experimental plugin in Unreal Engine 5. The main subsystem that relies on this variable is the TargetingSubsystem, as evidenced by its usage in the TargetingSubsystem.cpp file.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.

The associated variable bEnableTargetingDebugging interacts directly with ts.debug.EnableTargetingDebugging. They share the same value, with bEnableTargetingDebugging being the actual boolean variable used in the code to check if targeting debugging is enabled.

Developers must be aware that this variable is only effective when ENABLE_DRAW_DEBUG is defined, as indicated by the #if ENABLE_DRAW_DEBUG preprocessor directive. This means that in release builds or when debug drawing is disabled, this setting may have no effect.

Best practices when using this variable include:

  1. Only enabling it during development and debugging sessions, not in production builds.
  2. Using it in conjunction with other debugging tools to get a comprehensive view of the targeting system’s behavior.
  3. Being aware of potential performance impacts when enabled, as it may introduce additional overhead for debugging visualizations.

Regarding the associated variable bEnableTargetingDebugging:

The purpose of bEnableTargetingDebugging is to serve as the actual boolean flag used within the code to determine if targeting debugging is enabled. It’s the internal representation of the console variable ts.debug.EnableTargetingDebugging.

This variable is used within the TargetingSubsystem module of the Gameplay Targeting System plugin. It’s accessed through the TargetingSystemCVars namespace, indicating that it’s part of the console variable system for this specific plugin.

The value of bEnableTargetingDebugging is set indirectly through the ts.debug.EnableTargetingDebugging console variable. When the console variable is changed, bEnableTargetingDebugging is automatically updated to reflect the new value.

The IsTargetingDebugEnabled() function in the UTargetingSubsystem class directly returns the value of bEnableTargetingDebugging, providing a clean interface for other parts of the system to check if targeting debugging is enabled.

Developers should be aware that this variable is a static boolean within the TargetingSystemCVars namespace, meaning it’s shared across all instances of the targeting system.

Best practices for using bEnableTargetingDebugging include:

  1. Accessing it through the provided UTargetingSubsystem::IsTargetingDebugEnabled() function rather than directly, to maintain encapsulation.
  2. Using it to conditionally execute debug-only code or visualizations within the targeting system.
  3. Remembering that changes to this variable will affect all instances of the targeting system globally.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/GameplayTargetingSystem/Source/GameplayTargetingSystem/Private/TargetingSystem/TargetingSubsystem.cpp:40

Scope (from outer to inner):

file
namespace    TargetingSystemCVars

Source code excerpt:

	static bool bEnableTargetingDebugging = false;
	FAutoConsoleVariableRef CvarEnableTargetingDebugging(
		TEXT("ts.debug.EnableTargetingDebugging"),
		bEnableTargetingDebugging,
		TEXT("Toggles whether the targeting system is actively in debugging mode. (Enabled: true, Disabled: false)")
	);

	static bool bForceRequeueAsyncRequests = false;
	FAutoConsoleVariableRef CvarForceRequeueAsyncRequests(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/GameplayTargetingSystem/Source/GameplayTargetingSystem/Private/TargetingSystem/TargetingSubsystem.cpp:38

Scope (from outer to inner):

file
namespace    TargetingSystemCVars

Source code excerpt:

#if ENABLE_DRAW_DEBUG

	static bool bEnableTargetingDebugging = false;
	FAutoConsoleVariableRef CvarEnableTargetingDebugging(
		TEXT("ts.debug.EnableTargetingDebugging"),
		bEnableTargetingDebugging,
		TEXT("Toggles whether the targeting system is actively in debugging mode. (Enabled: true, Disabled: false)")
	);

	static bool bForceRequeueAsyncRequests = false;
	FAutoConsoleVariableRef CvarForceRequeueAsyncRequests(
		TEXT("ts.debug.ForceRequeueAsyncRequests"),

#Loc: <Workspace>/Engine/Plugins/Experimental/GameplayTargetingSystem/Source/GameplayTargetingSystem/Private/TargetingSystem/TargetingSubsystem.cpp:770

Scope (from outer to inner):

file
function     bool UTargetingSubsystem::IsTargetingDebugEnabled

Source code excerpt:

bool UTargetingSubsystem::IsTargetingDebugEnabled()
{
	return TargetingSystemCVars::bEnableTargetingDebugging;
}

float UTargetingSubsystem::GetOverrideTargetingLifeTime()
{
	return TargetingSystemCVars::OverrideTargetingLifeTime;
}