OSS.SteamUnitTest
OSS.SteamUnitTest
#Overview
name: OSS.SteamUnitTest
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether or not Steam is being force-enabled by NetcodeUnitTest
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of OSS.SteamUnitTest is to force-enable Steam within the NetcodeUnitTest commandlet for the Online Subsystem Steam plugin in Unreal Engine 5.
This setting variable is primarily used by the Online Subsystem Steam plugin, which is part of Unreal Engine’s online services infrastructure. It specifically interacts with the NetcodeUnitTest system, which is used for testing network-related functionality.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.
The associated variable CVarSteamUnitTest directly interacts with OSS.SteamUnitTest. They share the same value and purpose, with CVarSteamUnitTest being the actual C++ variable that holds the console variable’s value.
Developers must be aware that this variable is only available in non-shipping builds (as indicated by the #if !UE_BUILD_SHIPPING directive). It’s specifically designed for testing purposes and should not be used in production code.
Best practices when using this variable include:
- Only use it for unit testing purposes, particularly with NetcodeUnitTest.
- Be aware that enabling this will force-enable Steam, which may affect other parts of your game or application.
- Always disable it after testing to ensure it doesn’t interfere with normal gameplay or other online subsystems.
- Use it in conjunction with other Steam-related testing tools and methodologies for comprehensive testing of Steam integration.
Regarding the associated variable CVarSteamUnitTest:
The purpose of CVarSteamUnitTest is to provide a C++ accessible version of the OSS.SteamUnitTest console variable. It’s used internally by the Online Subsystem Steam plugin to check whether Steam should be force-enabled for unit testing.
This variable is part of the Online Subsystem Steam plugin and is used within the FOnlineSubsystemSteam class.
The value of CVarSteamUnitTest is set when the OSS.SteamUnitTest console variable is modified. It’s accessed using the GetValueOnGameThread() method.
CVarSteamUnitTest directly interacts with the IsEnabled() function of FOnlineSubsystemSteam, where it’s used to determine if Steam should be force-enabled.
Developers should be aware that this variable is only checked in non-shipping builds and its value can affect the behavior of the Steam subsystem during testing.
Best practices for CVarSteamUnitTest include:
- Use it only for debugging and testing purposes.
- Be cautious when modifying its value, as it can affect the entire Steam subsystem’s behavior.
- Always reset it to its default value (0) after testing to avoid unintended side effects.
- Use it in combination with other Steam-related debugging tools for comprehensive testing and debugging of Steam integration.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSubsystemSteam.cpp:59
Scope (from outer to inner):
file
namespace OSSConsoleVariables
Source code excerpt:
/** CVar used by NetcodeUnitTest, to force-enable Steam within the unit test commandlet */
TAutoConsoleVariable<int32> CVarSteamUnitTest(
TEXT("OSS.SteamUnitTest"),
0,
TEXT("Whether or not Steam is being force-enabled by NetcodeUnitTest"),
ECVF_Default);
#endif
}
#Associated Variable and Callsites
This variable is associated with another variable named CVarSteamUnitTest
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSubsystemSteam.cpp:58
Scope (from outer to inner):
file
namespace OSSConsoleVariables
Source code excerpt:
#if !UE_BUILD_SHIPPING
/** CVar used by NetcodeUnitTest, to force-enable Steam within the unit test commandlet */
TAutoConsoleVariable<int32> CVarSteamUnitTest(
TEXT("OSS.SteamUnitTest"),
0,
TEXT("Whether or not Steam is being force-enabled by NetcodeUnitTest"),
ECVF_Default);
#endif
}
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSubsystemSteam.cpp:565
Scope (from outer to inner):
file
function bool FOnlineSubsystemSteam::IsEnabled
Source code excerpt:
#if !UE_BUILD_SHIPPING
// Force-enable Steam for NetcodeUnitTest
if (!!OSSConsoleVariables::CVarSteamUnitTest.GetValueOnGameThread())
{
bEnableSteam = true;
}
#endif
}