MinWindowWidth
MinWindowWidth
#Overview
name: MinWindowWidth
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MinWindowWidth is to define the minimum width allowed for various windows in Unreal Engine 5, particularly for the game window and certain editor dialogs.
This setting variable is primarily used in two Unreal Engine subsystems:
- The Editor subsystem, specifically in the New Level Dialog module.
- The Runtime Engine subsystem, particularly in the Game Engine initialization.
The value of this variable is set in different ways depending on the context:
- In the New Level Dialog, it’s defined as a constant (320 pixels).
- In the Game Engine, it’s retrieved from project settings using the GetProjectSettingInt function, with a default value of 640 pixels if not specified in the project settings.
MinWindowWidth interacts with other variables such as MinWindowHeight, MaxWindowWidth, and MaxWindowHeight to define the size constraints of windows.
Developers should be aware that:
- This variable affects the minimum size to which users can resize windows.
- Different subsystems may use different default values.
- In the game runtime, this value can be customized in the project settings.
Best practices when using this variable include:
- Ensuring that the minimum width is sufficient to display all necessary UI elements.
- Considering different screen resolutions and aspect ratios when setting this value.
- Testing the application on various devices to ensure the minimum width is appropriate for all target platforms.
- In game projects, explicitly setting this value in project settings if the default (640) is not suitable for your game’s UI layout.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:83, section: [/Script/EngineSettings.GeneralProjectSettings]
- INI Section:
/Script/EngineSettings.GeneralProjectSettings
- Raw value:
16
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/NewLevelDialog/Private/NewLevelDialogModule.cpp:40
Scope (from outer to inner):
file
namespace NewLevelDialogDefs
Source code excerpt:
constexpr float LargeWindowWidth = 1008;
constexpr float MinWindowHeight = 280;
constexpr float MinWindowWidth = 320;
}
struct FNewLevelTemplateItem
{
FTemplateMapInfo TemplateMapInfo;
FText Name;
#Loc: <Workspace>/Engine/Source/Editor/NewLevelDialog/Private/NewLevelDialogModule.cpp:586
Scope (from outer to inner):
file
function bool FNewLevelDialogModule::CreateAndShowTemplateDialog
Source code excerpt:
.ClientSize(WindowClientSize)
.MinHeight(NewLevelDialogDefs::MinWindowHeight)
.MinWidth(NewLevelDialogDefs::MinWindowWidth)
.SizingRule( ESizingRule::UserSized )
.SupportsMinimize(false)
.SupportsMaximize(false);
TSharedRef<SNewLevelDialog> NewLevelDialog =
SNew(SNewLevelDialog)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:542
Scope: file
Source code excerpt:
const bool bAllowMinimize = GetProjectSettingBool(TEXT("bAllowMinimize"), true);
const int32 MinWindowWidth = GetProjectSettingInt(TEXT("MinWindowWidth"), 640);
const int32 MinWindowHeight = GetProjectSettingInt(TEXT("MinWindowHeight"), 480);
// Allow optional winX/winY parameters to set initial window position
EAutoCenter AutoCenterType = EAutoCenter::PrimaryWorkArea;
int32 WinX=0;
int32 WinY=0;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:609
Scope: file
Source code excerpt:
.AutoCenter(AutoCenterType)
.ScreenPosition(FVector2D(WinX, WinY))
.MinWidth(MinWindowWidth)
.MinHeight(MinWindowHeight)
.MaxWidth(MaxWindowWidth)
.MaxHeight(MaxWindowHeight)
.FocusWhenFirstShown(true)
.SaneWindowPlacement(AutoCenterType == EAutoCenter::None)
.UseOSWindowBorder(!bUseBorderlessWindow)