UI.DebugUpdateCheck
UI.DebugUpdateCheck
#Overview
name: UI.DebugUpdateCheck
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Force switch between update states (-1 is off)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of UI.DebugUpdateCheck is to enable debugging and testing of the update manager system in Unreal Engine 5. It allows developers to force specific update states for testing purposes.
This setting variable is primarily used by the Hotfix plugin, which is part of the OnlineFramework module in Unreal Engine 5. The plugin is responsible for managing and applying updates to the game.
The value of this variable is set through a console command, as it is defined as a TAutoConsoleVariable. By default, it is set to -1, which means the debug feature is turned off.
UI.DebugUpdateCheck interacts directly with the CVarDebugUpdateManager variable. They share the same value and purpose, with CVarDebugUpdateManager being the actual variable used in the code to access the debug value.
Developers should be aware that this variable is only effective in non-shipping builds (i.e., development, debug, or test builds). It’s specifically guarded by a #if !UE_BUILD_SHIPPING directive, ensuring that it doesn’t affect release builds.
Best practices for using this variable include:
- Only use it for debugging and testing purposes.
- Remember to set it back to -1 (off) after testing to ensure normal update behavior.
- Be cautious when forcing update states, as it may interfere with the normal update process and potentially cause unexpected behavior.
Regarding the associated variable CVarDebugUpdateManager:
The purpose of CVarDebugUpdateManager is to provide a programmatic way to access and manipulate the UI.DebugUpdateCheck value within the C++ code of the Hotfix plugin.
It is used directly in the CheckComplete function of the UUpdateManager class to override the normal update completion status for debugging purposes. When set to a value between 0 and the maximum value of EUpdateCompletionStatus, it forces the update completion status to that specific state.
The value of CVarDebugUpdateManager is set and accessed using the GetValueOnGameThread() method, which retrieves the current console variable value.
Developers should be aware that modifying CVarDebugUpdateManager will directly affect the behavior of the update manager, potentially causing unexpected results if not used carefully.
Best practices for using CVarDebugUpdateManager include:
- Only use it in controlled testing environments.
- Always log when it’s being used to override normal behavior, as demonstrated in the provided code snippet.
- Ensure it’s reset to its default value (-1) after testing to prevent unintended effects on the update process.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineFramework/Source/Hotfix/Private/UpdateManager.cpp:20
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDebugUpdateManager(
TEXT("UI.DebugUpdateCheck"),
-1,
TEXT("Force switch between update states (-1 is off)"));
struct FLoadingScreenConfig
{
public:
#Associated Variable and Callsites
This variable is associated with another variable named CVarDebugUpdateManager
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineFramework/Source/Hotfix/Private/UpdateManager.cpp:19
Scope: file
Source code excerpt:
#define UPDATE_CHECK_SECONDS 30.0
static TAutoConsoleVariable<int32> CVarDebugUpdateManager(
TEXT("UI.DebugUpdateCheck"),
-1,
TEXT("Force switch between update states (-1 is off)"));
struct FLoadingScreenConfig
{
#Loc: <Workspace>/Engine/Plugins/Online/OnlineFramework/Source/Hotfix/Private/UpdateManager.cpp:200
Scope (from outer to inner):
file
function void UUpdateManager::CheckComplete
Source code excerpt:
#if !UE_BUILD_SHIPPING
int32 DbgVal = CVarDebugUpdateManager.GetValueOnGameThread();
if (DbgVal >= 0 && DbgVal <= (int32)EUpdateCompletionStatus::UpdateFailure_NotLoggedIn)
{
Result = (EUpdateCompletionStatus)DbgVal;
UE_LOG(LogHotfixManager, Display, TEXT("CheckComplete OVERRIDE! %s"), UpdateCompletionEnum ? *UpdateCompletionEnum->GetNameStringByValue((int64)Result) : TEXT("Invalid"));
}
#endif