bSupportsPortraitOrientation
bSupportsPortraitOrientation
#Overview
name: bSupportsPortraitOrientation
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 6
C++ source files. Also referenced in 2
C# build files meaning it may affect the build system logic.
#Summary
#Usage in the C++ source code
The purpose of bSupportsPortraitOrientation is to specify whether the iOS application supports portrait orientation. This setting is part of the device orientation configuration for iOS games and applications developed with Unreal Engine 5.
This setting variable is primarily used by the iOS-specific modules of Unreal Engine, including the IOSRuntimeSettings and IOSPlatformEditor. It’s also referenced in the PIEPreviewDeviceProfileSelector module for determining screen orientation requirements during Play-in-Editor sessions.
The value of this variable is typically set in the project’s configuration files, specifically in the IOSRuntimeSettings section of the engine configuration file (GEngineIni). It can be modified through the Unreal Engine editor’s project settings interface for iOS.
Several other orientation-related variables interact with bSupportsPortraitOrientation, including bSupportsUpsideDownOrientation, bSupportsLandscapeLeftOrientation, and bSupportsLandscapeRightOrientation. These variables collectively determine the supported orientations for the iOS application.
Developers should be aware that this variable affects the application’s behavior on iOS devices. If set to false, the application will not support portrait orientation, which may impact user experience on certain devices or for certain types of applications.
Best practices when using this variable include:
- Ensuring at least one orientation is supported (portrait or landscape).
- Considering the target audience and typical use cases for the application when deciding on supported orientations.
- Testing the application thoroughly on various iOS devices to ensure proper behavior in all supported orientations.
- Updating the Info.plist file accordingly to reflect the supported orientations, which is typically handled automatically by the Unreal Engine build process.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2979, section: [/Script/IOSRuntimeSettings.IOSRuntimeSettings]
- INI Section:
/Script/IOSRuntimeSettings.IOSRuntimeSettings
- Raw value:
False
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Developer/IOS/IOSPlatformEditor/Private/IOSTargetSettingsCustomization.cpp:800
Scope: file
Source code excerpt:
SETUP_STATUS_PROP(BundleIdentifier, BundleCategory);
SETUP_PLIST_PROP(VersionInfo, BundleCategory);
SETUP_PLIST_PROP(bSupportsPortraitOrientation, OrientationCategory);
SETUP_PLIST_PROP(bSupportsUpsideDownOrientation, OrientationCategory);
SETUP_PLIST_PROP(bSupportsLandscapeLeftOrientation, OrientationCategory);
SETUP_PLIST_PROP(bSupportsLandscapeRightOrientation, OrientationCategory);
SETUP_PLIST_PROP(PreferredLandscapeOrientation, OrientationCategory);
SETUP_PLIST_PROP(bSupportsITunesFileSharing, FileSystemCategory);
#Loc: <Workspace>/Engine/Source/Editor/PIEPreviewDeviceProfileSelector/Private/PIEPreviewDevice.cpp:213
Scope (from outer to inner):
file
function void FPIEPreviewDevice::DetermineScreenOrientationRequirements
Source code excerpt:
case EPIEPreviewDeviceType::IOS:
{
bool bSupportsPortraitOrientation;
bool bSupportsUpsideDownOrientation;
bool bSupportsLandscapeLeftOrientation;
bool bSupportsLandscapeRightOrientation;
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsPortraitOrientation"), bSupportsPortraitOrientation, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsUpsideDownOrientation"), bSupportsUpsideDownOrientation, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsLandscapeLeftOrientation"), bSupportsLandscapeLeftOrientation, GEngineIni);
GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsLandscapeRightOrientation"), bSupportsLandscapeRightOrientation, GEngineIni);
bNeedPortrait = bSupportsPortraitOrientation || bSupportsUpsideDownOrientation;
bNeedLandscape = bSupportsLandscapeLeftOrientation || bSupportsLandscapeRightOrientation;
}
break;
}
}
#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSAppDelegate.cpp:1135
Scope: file
Source code excerpt:
// This is called during app startup and IOSRuntimeSettings may not have been loaded yet
bool hasValue = GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bSupportsPortraitOrientation"), bSupportsPortrait, GEngineIni);
NSArray<NSString*> *SupportedOrientations = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UISupportedInterfaceOrientations"];
if (!hasValue && SupportedOrientations != NULL)
{
// Loop through the Info.plist UISupportedInterfaceOrientations array values looking for "Portrait", "Left" and "Right"
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF == %@", @"UIInterfaceOrientationPortrait"];
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:364
Scope (from outer to inner):
file
class class UIOSRuntimeSettings : public UObject
Source code excerpt:
// Supports default portrait orientation. Landscape will not be supported.
UPROPERTY(GlobalConfig, EditAnywhere, Category = DeviceOrientations)
uint32 bSupportsPortraitOrientation : 1;
// Supports upside down portrait orientation. Landscape will not be supported.
UPROPERTY(GlobalConfig, EditAnywhere, Category = DeviceOrientations)
uint32 bSupportsUpsideDownOrientation : 1;
// Supports left landscape orientation. Portrait will not be supported.
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:28
Scope (from outer to inner):
file
function UIOSRuntimeSettings::UIOSRuntimeSettings
Source code excerpt:
bEnableCloudKitSupport = false;
bUserSwitching = false;
bSupportsPortraitOrientation = true;
bSupportsITunesFileSharing = false;
bSupportsFilesApp = false;
BundleDisplayName = TEXT("UnrealGame");
BundleName = TEXT("MyUnrealGame");
BundleIdentifier = TEXT("com.YourCompany.GameNameNoSpaces");
VersionInfo = TEXT("1.0.0");
#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:81
Scope (from outer to inner):
file
function void UIOSRuntimeSettings::PostEditChangeProperty
Source code excerpt:
// Ensure that at least one orientation is supported
if (!bSupportsPortraitOrientation && !bSupportsUpsideDownOrientation && !bSupportsLandscapeLeftOrientation && !bSupportsLandscapeRightOrientation)
{
bSupportsPortraitOrientation = true;
UpdateSinglePropertyInConfigFile(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(UIOSRuntimeSettings, bSupportsPortraitOrientation)), GetDefaultConfigFilename());
}
// Ensure that at least one API is supported
if (!bSupportsMetal && !bSupportsMetalMRT)
{
bSupportsMetal = true;
#References in C# build files
This variable is referenced in the following C# build files:
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/IOS/UEDeployIOS.cs:562
string SupportedOrientations = "";
bool bSupported = true;
Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsPortraitOrientation", out bSupported);
SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortrait</string>\n" : "";
bool bSupportsPortrait = bSupported;
Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsUpsideDownOrientation", out bSupported);
SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n" : "";
bSupportsPortrait |= bSupported;
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/IOS/UEDeployIOS.cs:229
string SupportedOrientations = "";
bool bSupported = true;
Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsPortraitOrientation", out bSupported);
SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortrait</string>\n" : "";
bool bSupportsPortrait = bSupported;
Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bSupportsUpsideDownOrientation", out bSupported);
SupportedOrientations += bSupported ? "\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n" : "";
bSupportsPortrait |= bSupported;