AutomationScreenshotResolutionWidth
AutomationScreenshotResolutionWidth
#Overview
name: AutomationScreenshotResolutionWidth
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The width of automation screenshots.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AutomationScreenshotResolutionWidth is to specify the width of automation screenshots in Unreal Engine 5. This setting is primarily used for the automated testing and quality assurance processes within the engine.
This setting variable is primarily relied upon by the Functional Testing module of Unreal Engine 5, as evidenced by its location in the FunctionalTesting directory and its use in the AutomationBlueprintFunctionLibrary.
The value of this variable is set through a console variable (CVar) system, which allows it to be changed at runtime or through configuration files. It’s defined using the TAutoConsoleVariable template, which creates a console variable that can be accessed and modified during runtime.
AutomationScreenshotResolutionWidth interacts closely with another variable, AutomationScreenshotResolutionHeight, which together define the dimensions of automation screenshots.
Developers should be aware that this variable affects the resolution of screenshots taken during automated testing. If set to 0 (the default value), the engine will likely use a default or calculated value for the screenshot width.
Best practices when using this variable include:
- Setting it to a non-zero value if specific screenshot dimensions are required for testing.
- Ensuring that both width and height variables are set appropriately to maintain the desired aspect ratio.
- Considering performance implications when setting very high resolutions, especially for tests running on less powerful hardware.
Regarding the associated variable CVarAutomationScreenshotResolutionWidth:
The purpose of CVarAutomationScreenshotResolutionWidth is to provide a runtime-accessible representation of the AutomationScreenshotResolutionWidth setting. It’s the actual console variable that stores and provides access to the width value.
This variable is used within the Functional Testing module, specifically in the AutomationBlueprintFunctionLibrary, to retrieve the current setting for screenshot width during automated testing.
The value of this variable is set when the engine initializes the console variable system, and it can be modified at runtime through console commands or programmatically.
CVarAutomationScreenshotResolutionWidth interacts directly with the AutomationScreenshotResolutionWidth setting, essentially serving as its runtime representation.
Developers should be aware that changes to this variable will immediately affect the behavior of automation screenshot capture.
Best practices for using this variable include:
- Using the appropriate console commands or configuration files to modify its value, rather than trying to change it directly in code.
- Checking its value using GetValueOnGameThread() when you need the current screenshot width setting in your code.
- Considering creating a user-facing setting in your game or tool that modifies this CVar if you want to give users control over automation screenshot dimensions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:67
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarAutomationScreenshotResolutionWidth(
TEXT("AutomationScreenshotResolutionWidth"),
0,
TEXT("The width of automation screenshots."),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarAutomationScreenshotResolutionHeight(
TEXT("AutomationScreenshotResolutionHeight"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarAutomationScreenshotResolutionWidth
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:66
Scope: file
Source code excerpt:
DEFINE_LOG_CATEGORY_STATIC(AutomationFunctionLibrary, Log, Log)
static TAutoConsoleVariable<int32> CVarAutomationScreenshotResolutionWidth(
TEXT("AutomationScreenshotResolutionWidth"),
0,
TEXT("The width of automation screenshots."),
ECVF_Default);
static TAutoConsoleVariable<int32> CVarAutomationScreenshotResolutionHeight(
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:760
Scope (from outer to inner):
file
function FIntPoint UAutomationBlueprintFunctionLibrary::GetAutomationScreenshotSize
Source code excerpt:
// Failing to find an override, look for a platform override that may have been provided through the
// device profiles setup, to configure the CVars for controlling the automation screenshot size.
int32 OverrideWidth = CVarAutomationScreenshotResolutionWidth.GetValueOnGameThread();
int32 OverrideHeight = CVarAutomationScreenshotResolutionHeight.GetValueOnGameThread();
if (OverrideWidth > 0)
{
ResolutionX = (uint32)OverrideWidth;
}