Mobile.EnableUITextScaling
Mobile.EnableUITextScaling
#Overview
name: Mobile.EnableUITextScaling
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables Mobile UI Text Scaling
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Mobile.EnableUITextScaling is to enable or disable text scaling for mobile user interfaces in Unreal Engine 5. This setting variable is primarily used for the UI system, specifically for mobile platforms.
Based on the Callsites section, this setting variable is utilized in the CommonUI plugin, which is part of the Unreal Engine’s Runtime plugins. The CommonUI plugin is responsible for providing common UI functionalities across different platforms.
The value of this variable is set through a console variable system, as indicated by the use of TAutoConsoleVariable. It is initialized with a default value of 0, which means mobile UI text scaling is disabled by default.
The associated variable EnableMobileUITextScaling directly interacts with Mobile.EnableUITextScaling. They share the same value and purpose, with EnableMobileUITextScaling being the in-code representation of the console variable.
Developers must be aware that this variable is specifically for mobile platforms and affects text scaling in the UI. When using this variable, they should consider the impact on UI readability and layout across different mobile devices with varying screen sizes and resolutions.
Best practices when using this variable include:
- Testing the UI with both enabled and disabled states to ensure proper functionality and appearance.
- Considering the target audience and devices when deciding whether to enable text scaling.
- Using this in conjunction with other UI scaling techniques for a comprehensive mobile UI strategy.
Regarding the associated variable EnableMobileUITextScaling:
The purpose of EnableMobileUITextScaling is to provide a programmatic way to access and control the Mobile.EnableUITextScaling setting within the C++ code of the CommonUI plugin.
This variable is used in the CommonUIUtils namespace, specifically in the ShouldDisplayMobileUISizes() function. The function returns true if EnableMobileUITextScaling is set to 1, indicating that mobile UI text scaling should be applied.
The value of this variable is set through the console variable system, matching the value of Mobile.EnableUITextScaling.
Developers should be aware that this variable directly controls the behavior of mobile UI text scaling in the CommonUI plugin. Changes to this variable will affect how text is displayed in mobile UIs.
Best practices for using EnableMobileUITextScaling include:
- Using the ShouldDisplayMobileUISizes() function to check if mobile UI sizes should be used, rather than directly accessing the variable.
- Considering platform-specific requirements when utilizing this variable in UI code.
- Documenting any custom logic that depends on this variable to ensure consistent UI behavior across the project.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonUIUtils.cpp:9
Scope (from outer to inner):
file
namespace CommonUIUtils
Source code excerpt:
{
static TAutoConsoleVariable<int32> EnableMobileUITextScaling(
TEXT("Mobile.EnableUITextScaling"),
0,
TEXT("Enables Mobile UI Text Scaling"),
ECVF_Default);
bool ShouldDisplayMobileUISizes()
{
#Associated Variable and Callsites
This variable is associated with another variable named EnableMobileUITextScaling
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonUIUtils.cpp:8
Scope (from outer to inner):
file
namespace CommonUIUtils
Source code excerpt:
namespace CommonUIUtils
{
static TAutoConsoleVariable<int32> EnableMobileUITextScaling(
TEXT("Mobile.EnableUITextScaling"),
0,
TEXT("Enables Mobile UI Text Scaling"),
ECVF_Default);
bool ShouldDisplayMobileUISizes()
#Loc: <Workspace>/Engine/Plugins/Runtime/CommonUI/Source/CommonUI/Private/CommonUIUtils.cpp:19
Scope (from outer to inner):
file
namespace CommonUIUtils
function bool ShouldDisplayMobileUISizes
Source code excerpt:
return true;
#endif
return EnableMobileUITextScaling->GetInt() == 1;
}
FString PrintAllOwningUserWidgets(const UWidget* Widget)
{
FString OutputString;
const UUserWidget* ParentWidget = nullptr;