bEnableOnScreenDebugMessages
bEnableOnScreenDebugMessages
#Overview
name: bEnableOnScreenDebugMessages
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bEnableOnScreenDebugMessages is to control the display of on-screen debug messages in Unreal Engine 5. This variable is primarily used for debugging and development purposes, allowing developers to toggle the visibility of debug information directly on the game screen.
This setting variable is primarily used by the Engine subsystem, specifically within the UEngine class. It’s also utilized in various debugging and viewport-related modules, such as the Animation Editor Viewport and the Gameplay Debugger.
The value of this variable is initially set in the engine configuration file (GEngineIni) and can be modified at runtime. It’s typically initialized in the UEngine::Init function.
bEnableOnScreenDebugMessages interacts closely with another variable, bEnableOnScreenDebugMessagesDisplay. While bEnableOnScreenDebugMessages controls the overall system, bEnableOnScreenDebugMessagesDisplay determines if the messages should be shown at a given moment.
Developers should be aware that this variable is intended for development and debugging purposes only. It should not be relied upon for gameplay features or left enabled in shipping builds. The variable is excluded from UE_BUILD_SHIPPING and UE_BUILD_TEST configurations.
Best practices when using this variable include:
- Only enable it during development and testing phases.
- Use it in conjunction with AddOnScreenDebugMessage() for displaying temporary debug information.
- Remember to disable it before creating release builds.
- Be mindful of performance impact when many debug messages are displayed.
- Use the console commands “ToggleOnScreenDebugMessageDisplay” and “ToggleOnScreenDebugMessageSystem” to control it during runtime for easier debugging.
By following these practices, developers can effectively use on-screen debug messages without negatively impacting the final product or performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:320, section: [/Script/Engine.Engine]
- INI Section:
/Script/Engine.Engine
- Raw value:
true
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/AnimationEditorViewportClient.cpp:677
Scope (from outer to inner):
file
function void FAnimationViewportClient::DrawCanvas
Source code excerpt:
#if !(UE_BUILD_TEST)
if (World && GEngine->bEnableOnScreenDebugMessagesDisplay && GEngine->bEnableOnScreenDebugMessages)
{
constexpr int32 MessageX = 20;
constexpr int32 MessageY = 65;
GEngine->DrawOnscreenDebugMessages(World, Viewport, &Canvas, nullptr, MessageX, MessageY);
}
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:1708
Scope (from outer to inner):
file
class class UEngine : public UObject , public FExec
Source code excerpt:
/** If true, then disable OnScreenDebug messages. Can be toggled in real-time. */
UPROPERTY(globalconfig)
uint32 bEnableOnScreenDebugMessages:1;
/** If true, then disable the display of OnScreenDebug messages (used when running) */
UPROPERTY(transient)
uint32 bEnableOnScreenDebugMessagesDisplay:1;
/** If true, then skip drawing map warnings on screen even in non (UE_BUILD_SHIPPING || UE_BUILD_TEST) builds */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:2072
Scope (from outer to inner):
file
function void UEngine::Init
Source code excerpt:
{
bool bTemp = true;
GConfig->GetBool(TEXT("/Script/Engine.Engine"), TEXT("bEnableOnScreenDebugMessages"), bTemp, GEngineIni);
bEnableOnScreenDebugMessages = bTemp ? true : false;
bEnableOnScreenDebugMessagesDisplay = bEnableOnScreenDebugMessages;
}
// Update Script Maximum loop iteration count
FBlueprintCoreDelegates::SetScriptMaximumLoopIterations( GEngine->MaximumLoopIterationCount );
SetNearClipPlaneGlobals(NearClipPlane);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:9749
Scope (from outer to inner):
file
function bool UEngine::HandleToggleOnscreenDebugMessageDisplayCommand
Source code excerpt:
UE_LOG(LogEngine, Log, TEXT("OnScreenDebug Message Display is now %s"),
GEngine->bEnableOnScreenDebugMessagesDisplay ? TEXT("ENABLED") : TEXT("DISABLED"));
if ((GEngine->bEnableOnScreenDebugMessagesDisplay == true) && (GEngine->bEnableOnScreenDebugMessages == false))
{
UE_LOG(LogEngine, Log, TEXT("OnScreenDebug Message system is DISABLED!"));
}
return true;
}
bool UEngine::HandleToggleOnscreenDebugMessageSystemCommand( const TCHAR* Cmd, FOutputDevice& Ar )
{
GEngine->bEnableOnScreenDebugMessages = !GEngine->bEnableOnScreenDebugMessages;
UE_LOG(LogEngine, Log, TEXT("OnScreenDebug Message System is now %s"),
GEngine->bEnableOnScreenDebugMessages ? TEXT("ENABLED") : TEXT("DISABLED"));
return true;
}
bool UEngine::HandleDisableAllScreenMessagesCommand( const TCHAR* Cmd, FOutputDevice& Ar )
{
GAreScreenMessagesEnabled = false;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:11397
Scope (from outer to inner):
file
function void UEngine::AddOnScreenDebugMessage
Source code excerpt:
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (bEnableOnScreenDebugMessages == true)
{
// Because some components add their message in concurrent work, we need a CS here.
FScopeLock ScopeLock(&GOnScreenMessageCS);
if (Key == (uint64)-1)
{
if (bNewerOnTop)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:11581
Scope (from outer to inner):
file
function bool UEngine::OnScreenDebugMessageExists
Source code excerpt:
{
#if !UE_BUILD_SHIPPING
if (bEnableOnScreenDebugMessages == true)
{
if (Key == (uint64)-1)
{
// Priority messages assumed to always exist...
// May want to check for there being none.
return true;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:12627
Scope (from outer to inner):
file
function void DrawStatsHUD
Source code excerpt:
#if !(UE_BUILD_TEST)
if (GEngine->bEnableOnScreenDebugMessagesDisplay && GEngine->bEnableOnScreenDebugMessages)
{
MessageY = GEngine->DrawOnscreenDebugMessages(World, Viewport, Canvas, CanvasObject, MessageX, MessageY);
}
#endif // UE_BUILD_TEST
TArray<FText> PlatformScreenWarnings;
#Loc: <Workspace>/Engine/Source/Runtime/GameplayDebugger/Private/GameplayDebuggerExtension_HUD.cpp:12
Scope (from outer to inner):
file
function FGameplayDebuggerExtension_HUD::FGameplayDebuggerExtension_HUD
Source code excerpt:
bIsGameHUDEnabled = false;
bAreDebugMessagesEnabled = false;
bPrevDebugMessagesEnabled = GEngine && GEngine->bEnableOnScreenDebugMessages;
bIsCachedDescriptionValid = false;
const FGameplayDebuggerInputHandlerConfig HUDKeyConfig(TEXT("ToggleHUD"), EKeys::Tilde.GetFName(), FGameplayDebuggerInputModifier::Ctrl);
const FGameplayDebuggerInputHandlerConfig MessagesKeyConfig(TEXT("ToggleMessages"), EKeys::Tab.GetFName(), FGameplayDebuggerInputModifier::Ctrl);
const bool bHasHUDBinding = BindKeyPress(HUDKeyConfig, this, &FGameplayDebuggerExtension_HUD::ToggleGameHUD);
#Loc: <Workspace>/Engine/Source/Runtime/GameplayDebugger/Private/GameplayDebuggerExtension_HUD.cpp:97
Scope (from outer to inner):
file
function void FGameplayDebuggerExtension_HUD::SetDebugMessagesEnabled
Source code excerpt:
if (GEngine)
{
GEngine->bEnableOnScreenDebugMessages = bEnable;
}
bAreDebugMessagesEnabled = bEnable;
bIsCachedDescriptionValid = false;
}