ShowFlag.GameplayDebug
ShowFlag.GameplayDebug
#Overview
name: ShowFlag.GameplayDebug
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.GameplayDebug is to control the visibility of gameplay debugging information drawn on screen by gameplay debugging components.
This setting variable is primarily used by the gameplay debugging system in Unreal Engine. Based on the callsites, it appears to be utilized by the GameplayAbilities plugin, specifically in the AbilitySystemDebugHUD class.
The value of this variable is set using the SHOWFLAG_FIXED_IN_SHIPPING macro, which indicates that it’s not accessible in shipping builds. It’s defined with an initial value of 0, meaning it’s off by default.
The associated variable GameplayDebug interacts closely with ShowFlag.GameplayDebug. They share the same value and purpose, as evidenced by the identical definition in the ShowFlagsValues.inl file.
Developers must be aware that this debug flag is only available in non-shipping builds. It’s categorized under SFG_Developer, indicating it’s intended for development use rather than end-user functionality.
Best practices when using this variable include:
- Only enable it when actively debugging gameplay systems.
- Ensure it’s disabled before creating shipping builds.
- Use it in conjunction with the UDebugDrawService for custom debug drawing.
Regarding the associated variable GameplayDebug:
The purpose of GameplayDebug is identical to ShowFlag.GameplayDebug - it controls the visibility of gameplay debugging information.
It’s used in the AbilitySystemDebugHUD class to register a debug draw delegate with the UDebugDrawService. This allows for custom debug drawing related to the gameplay systems.
The value is set in the same manner as ShowFlag.GameplayDebug, through the SHOWFLAG_FIXED_IN_SHIPPING macro.
Developers should be aware that this variable is used to register debug drawing services and should be careful about performance implications when enabled.
Best practices include using it sparingly and only when necessary for debugging, and ensuring all associated debug drawing code is properly optimized or conditionally compiled out for shipping builds.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:169
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, Navigation, SFG_Normal, NSLOCTEXT("UnrealEd", "NavigationSF", "Navigation"))
/** used by gameplay debugging components to debug-draw on screen */
SHOWFLAG_FIXED_IN_SHIPPING(0, GameplayDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "GameplayDebugSF", "Gameplay Debug"))
/** LightProfiles, usually 1d textures to have a light (IES), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(TexturedLightProfiles, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "TexturedLightProfilesSF", "Textured Light Profiles (IES Texture)"))
/** LightFunctions (masking light sources with a material), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(LightFunctions, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "LightFunctionsSF", "Light Functions"))
/** Draws instanced static meshes that are not foliage or grass, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedStaticMeshes, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedStaticMeshesSF", "Instanced Static Meshes"))
#Associated Variable and Callsites
This variable is associated with another variable named GameplayDebug
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemDebugHUD.cpp:345
Scope (from outer to inner):
file
function void AAbilitySystemDebugHUD::CreateHUD
Source code excerpt:
FDebugDrawDelegate DrawDebugDelegate = FDebugDrawDelegate::CreateUObject(HUD, &AAbilitySystemDebugHUD::DrawDebugHUD);
DrawDebugDelegateHandle = UDebugDrawService::Register(TEXT("GameplayDebug"), DrawDebugDelegate);
}
void AAbilitySystemDebugHUD::DrawWithBackground(UFont* InFont, const FString& Text, const FColor& TextColor, EAlignHorizontal::Type HAlign, float& OffsetX, EAlignVertical::Type VAlign, float& OffsetY, float Alpha)
{
float SizeX, SizeY;
Canvas->StrLen(InFont, Text, SizeX, SizeY);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:169
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, Navigation, SFG_Normal, NSLOCTEXT("UnrealEd", "NavigationSF", "Navigation"))
/** used by gameplay debugging components to debug-draw on screen */
SHOWFLAG_FIXED_IN_SHIPPING(0, GameplayDebug, SFG_Developer, NSLOCTEXT("UnrealEd", "GameplayDebugSF", "Gameplay Debug"))
/** LightProfiles, usually 1d textures to have a light (IES), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(TexturedLightProfiles, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "TexturedLightProfilesSF", "Textured Light Profiles (IES Texture)"))
/** LightFunctions (masking light sources with a material), for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(LightFunctions, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "LightFunctionsSF", "Light Functions"))
/** Draws instanced static meshes that are not foliage or grass, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(InstancedStaticMeshes, SFG_Advanced, NSLOCTEXT("UnrealEd", "InstancedStaticMeshesSF", "Instanced Static Meshes"))