r.Mobile.DesiredResY

r.Mobile.DesiredResY

#Overview

name: r.Mobile.DesiredResY

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Mobile.DesiredResY is to control the desired vertical resolution (Y-axis) for mobile platforms in Unreal Engine 5. It is primarily used for managing the rendering resolution on mobile devices.

This setting variable is mainly utilized by the ApplicationCore module, specifically in the Android and iOS subsystems of Unreal Engine. It plays a crucial role in determining the screen resolution and scaling for mobile devices.

The value of this variable is typically set through the console or configuration files. It can be modified at runtime using console commands or programmatically through the engine’s console variable system.

r.Mobile.DesiredResY interacts closely with r.Mobile.DesiredResX, which controls the horizontal resolution. Together, these variables allow developers to specify a target resolution for mobile devices.

Developers should be aware of the following when using this variable:

  1. Setting a non-zero value for r.Mobile.DesiredResY will use that value for the vertical resolution, while the horizontal resolution (X) will be calculated to maintain the aspect ratio.
  2. A value of 0 indicates that the engine should use the default or native resolution of the device.
  3. Changes to this variable can trigger layout changes and resolution adjustments in the rendering pipeline.

Best practices for using this variable include:

  1. Consider the performance implications of setting higher resolutions, especially on lower-end mobile devices.
  2. Use in conjunction with r.Mobile.DesiredResX to maintain proper aspect ratios.
  3. Test thoroughly on various mobile devices to ensure the chosen resolution provides a good balance between visual quality and performance.
  4. Be cautious when changing this value at runtime, as it may cause visual disruptions or performance fluctuations.
  5. Consider using dynamic resolution scaling techniques instead of fixed values for more flexible performance optimization.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3895

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarMobileDesiredResY(
	TEXT("r.Mobile.DesiredResY"),
	0,
	TEXT("Desired mobile Y resolution (shortest axis) (non-zero == use for Y, calculate X to retain aspect ratio)"),
	ECVF_Default);

static TAutoConsoleVariable<int32> CVarLWCTruncateMode(
	TEXT("r.MaterialEditor.LWCTruncateMode"),

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/Android/AndroidWindow.cpp:566

Scope (from outer to inner):

file
function     FPlatformRect FAndroidWindow::GetScreenRect

Source code excerpt:


	static IConsoleVariable* CVarResX = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResX"));
	static IConsoleVariable* CVarResY = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResY"));
	int32 RequestedResX = bIsOculusMobileApp ? 0 : CVarResX->GetInt();
	int32 RequestedResY = bIsOculusMobileApp ? 0 : CVarResY->GetInt();

	FString CmdLineMDRes;
	if (FParse::Value(FCommandLine::Get(), TEXT("mobileresx="), CmdLineMDRes, false))
	{

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSWindow.cpp:73

Scope: file

Source code excerpt:

	{
		IConsoleVariable* CVarResX = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResX"));
		IConsoleVariable* CVarResY = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResY"));
		
		// If CVarResX/Y needs to be reset, let that CVar callback handle the layout change
		bool OtherCVarChanged = false;
		if (CVarResX && CVarResX->GetInt() != 0)
		{
			CVarResX->Set(0, ECVF_SetByConsole);

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Public/Android/AndroidWindowUtils.h:39

Scope (from outer to inner):

file
namespace    AndroidWindowUtils
function     void ApplyContentScaleFactor

Source code excerpt:


		static IConsoleVariable* CVarResX = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResX"));
		static IConsoleVariable* CVarResY = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResY"));
		int32 RequestedResX = CVarResX->GetInt();
		int32 RequestedResY = CVarResY->GetInt();

		FString CmdLineCSF;
		if (FParse::Value(FCommandLine::Get(), TEXT("mcsf="), CmdLineCSF, false))
		{

#Loc: <Workspace>/Engine/Source/Runtime/Launch/Private/Android/AndroidEventManager.cpp:220

Scope (from outer to inner):

file
function     FAppEventManager::FAppEventManager

Source code excerpt:

	}

	IConsoleVariable* CVarResY = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Mobile.DesiredResY"));
	if (CVarResY != nullptr)
	{
		CVarResY->SetOnChangedCallback(FConsoleVariableDelegate::CreateStatic(&FAppEventManager::OnScaleFactorChanged));
	}
}