UGameUserSettings

Stores user settings for a game (for example graphics and sound settings), with the ability to save and load to and from a file.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/GameFramework/GameUserSettings.h

Include

#include "GameFramework/GameUserSettings.h"

Syntax

class UGameUserSettings : public UObject

Remarks

Stores user settings for a game (for example graphics and sound settings), with the ability to save and load to and from a file.

Variables

Name Description

Protected variable

int32

 

AudioQualityLevel

Protected variable

bool

 

bUseDesiredScreenHeight

If true, the desired screen height will be used to scale the render resolution automatically.

Public variable

bool

 

bUseDynamicResolution

Whether to use dynamic resolution or not. (public to allow UI to connect to it)

Protected variable

bool

 

bUseHDRDisplayOutput

HDR

Public variable

bool

 

bUseVSync

Whether to use VSync or not. (public to allow UI to connect to it)

Protected variable

int32

 

DesiredScreenHeight

Desired screen height used to calculate the resolution scale when user changes display mode

Protected variable

int32

 

DesiredScreenWidth

Desired screen width used to calculate the resolution scale when user changes display mode

Protected variable

float

 

FrameRateLimit

Frame rate cap

Protected variable

int32

 

FullscreenMode

Game window fullscreen mode 0 = Fullscreen 1 = Windowed fullscreen 2 = Windowed

Protected variable

int32

 

HDRDisplayOutputNits

HDR

Protected variable

int32

 

LastConfirmedAudioQualityLevel

Protected variable

int32

 

LastConfirmedFullscreenMode

Last user confirmed fullscreen mode setting.

Protected variable

float

 

LastCPUBenchmarkResult

Result of the last benchmark (CPU); -1 if there has not been a benchmark run

Protected variable

TArray< float >

 

LastCPUBenchmarkSteps

Result of each individual sub-section of the last CPU benchmark; empty if there has not been a benchmark run

Protected variable

float

 

LastGPUBenchmarkMultiplier

Multiplier used against the last GPU benchmark

Protected variable

float

 

LastGPUBenchmarkResult

Result of the last benchmark (GPU); -1 if there has not been a benchmark run

Protected variable

TArray< float >

 

LastGPUBenchmarkSteps

Result of each individual sub-section of the last GPU benchmark; empty if there has not been a benchmark run

Protected variable

float

 

LastRecommendedScreenHeight

Result of the last benchmark; calculated resolution to use.

Protected variable

float

 

LastRecommendedScreenWidth

Result of the last benchmark; calculated resolution to use.

Protected variable

int32

 

LastUserConfirmedDesiredScreenHeight

Desired screen height used to calculate the resolution scale when user changes display mode

Protected variable

int32

 

LastUserConfirmedDesiredScreenWidth

Desired screen width used to calculate the resolution scale when user changes display mode

Protected variable

uint32

 

LastUserConfirmedResolutionSizeX

Game screen resolution width, in pixels.

Protected variable

uint32

 

LastUserConfirmedResolutionSizeY

Game screen resolution height, in pixels.

Protected variable

float

 

MinResolutionScale

Min resolution scale we allow in current display mode

Protected variable

int32

 

PreferredFullscreenMode

Fullscreen mode to use when toggling between windowed and fullscreen.

Protected variable

uint32

 

ResolutionSizeX

Game screen resolution width, in pixels.

Protected variable

uint32

 

ResolutionSizeY

Game screen resolution height, in pixels.

Public variable

Scalability::FQ...

 

ScalabilityQuality

Cached for the UI, current state if stored in console variables

Protected variable

uint32

 

Version

All settings will be wiped and set to default if the serialized version differs from UE_GAMEUSERSETTINGS_VERSION.

Protected variable

int32

 

WindowPosX

Window PosX

Protected variable

int32

 

WindowPosY

Window PosY

Constructors

Name Description

Public function

UGameUserSettings

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Virtual

void

 

ApplyHardwareBenchmarkResults()

Applies the settings stored in ScalabilityQuality and saves settings

Public function Virtual

void

 

ApplyNonResolutionSettings()

Public function

void

 

ApplyResolutionSettings

(
    bool bCheckForCommandLineOverrides
)

Public function Virtual

void

 

ApplySettings

(
    bool bCheckForCommandLineOverrides
)

Applies all current user settings to the game and saves to permanent storage (e.g. file), optionally checking for command line overrides.

Public function Virtual

void

 

ConfirmVideoMode()

Mark current video mode settings (fullscreenmode/resolution) as being confirmed by the user

Public function

void

 

EnableHDRDisplayOutput

(
    bool bEnable,
    int32 DisplayNits
)

Enables or disables HDR display output. Can be called again to change the desired nit level

Protected function

float

 

FindResolutionQualityForScreenSize

(
    float Width,
    float Height
)

Picks the best resolution quality for a given screen size

Public function Const

int32

 

GetAntiAliasingQuality()

Returns the anti-aliasing quality (0..4, higher is better)

Public function Const

int32

 

GetAudioQualityLevel()

Returns the user's audio quality level setting

Public function Static

FString

 

GetConfigDir()

Public function Const

int32

 

GetCurrentHDRDisplayNits()

Returns 0 if HDR isn't supported or is turned off

Public function Static

FIntPoint

 

GetDefaultResolution()

Returns the default resolution when no resolution is set

Public function Virtual

float

 

GetDefaultResolutionScale()

Gets the desired resolution quality based on DesiredScreenWidth/Height and the current screen resolution

Public function Static

EWindowMode:...

 

GetDefaultWindowMode()

Returns the default window mode when no mode is set

Public function Static

FIntPoint

 

GetDefaultWindowPosition()

Returns the default window position when no position is set

Public function Const

FIntPoint

 

GetDesktopResolution()

Returns user's desktop resolution, in pixels.

Protected function Virtual

float

 

GetEffectiveFrameRateLimit()

Returns the effective frame rate limit (by default it returns the FrameRateLimit member)

Public function Const

int32

 

GetFoliageQuality()

Returns the foliage quality (0..4, higher is better)

Public function Static

int32

 

GetFramePace()

Gets the current frame pacing frame rate in fps, or 0 if none

Public function Const

float

 

GetFrameRateLimit()

Gets the user's frame rate limit (0 indiciates the frame rate limit is disabled)

Public function Const

EWindowMode:...

 

GetFullscreenMode()

Returns the user setting for game window fullscreen mode.

Public function Static

UGameUserSet...

 

GetGameUserSettings()

Returns the game local machine settings (resolution, windowing mode, scalability settings, etc...)

Public function Const

EWindowMode:...

 

GetLastConfirmedFullscreenMode()

Returns the last confirmed user setting for game window fullscreen mode.

Public function Const

FIntPoint

 

GetLastConfirmedScreenResolution()

Returns the last confirmed user setting for game screen resolution, in pixels.

Public function Const

float

 

GetLastCPUBenchmarkResult()

Returns the last CPU benchmark result (set by RunHardwareBenchmark)

Public function Const

TArray< floa...

 

GetLastCPUBenchmarkSteps()

Returns each individual step of the last CPU benchmark result (set by RunHardwareBenchmark)

Public function Const

float

 

GetLastGPUBenchmarkResult()

Returns the last GPU benchmark result (set by RunHardwareBenchmark)

Public function Const

TArray< floa...

 

GetLastGPUBenchmarkSteps()

Returns each individual step of the last GPU benchmark result (set by RunHardwareBenchmark)

Public function Virtual Const

int32

 

GetOverallScalabilityLevel()

Returns the overall scalability level (can return -1 if the settings are custom)

Public function Const

int32

 

GetPostProcessingQuality()

Returns the post-processing quality (0..4, higher is better)

Public function Const

EWindowMode:...

 

GetPreferredFullscreenMode()

Returns the user setting for game window fullscreen mode.

Public function Virtual

float

 

GetRecommendedResolutionScale()

Gets the recommended resolution quality based on LastRecommendedScreenWidth/Height and the current screen resolution

Public function Const

void

 

GetResolutionScaleInformationEx

(
    float& CurrentScaleNormalized,
    float& CurrentScaleValue,
    float& MinScaleValue,
    float& MaxScaleValue
)

Returns the current resolution scale and the range.

Public function Const

float

 

GetResolutionScaleNormalized()

Gets the current resolution scale as a normalized 0..1 value between MinScaleValue and MaxScaleValue.

Public function Const

FIntPoint

 

GetScreenResolution()

Returns the user setting for game screen resolution, in pixels.

Public function Const

int32

 

GetShadingQuality()

Returns the shading quality (0..4, higher is better)

Public function Const

int32

 

GetShadowQuality()

Returns the shadow quality (0..4, higher is better)

Public function Const

int32

 

GetTextureQuality()

Returns the texture quality (0..4, higher is better)

Public function Const

int32

 

GetViewDistanceQuality()

Returns the view distance quality (0..4, higher is better)

Public function Const

int32

 

GetVisualEffectQuality()

Returns the visual effects quality (0..4, higher is better)

Public function Virtual

FIntPoint

 

GetWindowPosition()

Public function Virtual Const

bool

 

IsDirty()

Checks if any user settings is different from current

Public function Const

bool

 

IsDynamicResolutionDirty()

Checks if the dynamic resolution user setting is different from current system setting

Public function Const

bool

 

IsDynamicResolutionEnabled()

Returns the user setting for dynamic resolution.

Public function Const

bool

 

IsFullscreenModeDirty()

Checks if the FullscreenMode user setting is different from current

Public function Const

bool

 

IsHDREnabled()

Public function Const

bool

 

IsScreenResolutionDirty()

Checks if the Screen Resolution user setting is different from current

Protected function Virtual

bool

 

IsVersionValid()

Check if the current version of the game user settings is valid.

Public function Const

bool

 

IsVSyncDirty()

Checks if the vsync user setting is different from current system setting

Public function Const

bool

 

IsVSyncEnabled()

Returns the user setting for vsync.

Public function Static

void

 

LoadConfigIni

(
    bool bForceReload
)

Loads the user .ini settings into GConfig

Public function Virtual

void

 

LoadSettings

(
    bool bForceReload
)

Loads the user settings from persistent storage

Public function Static

void

 

PreloadResolutionSettings()

Loads the resolution settings before is object is available

Public function Static

void

 

RequestResolutionChange

(
    int32 InResolutionX,
    int32 InResolutionY,
    EWindowMode::Type InWindowMode,
    bool bInDoOverrides
)

Request a change to the specified resolution and window mode. Optionally apply cmd line overrides.

Public function

void

 

RequestUIUpdate()

Public function Virtual

void

 

ResetToCurrentSettings()

This function resets all settings to the current system settings

Public function

void

 

RevertVideoMode()

Revert video mode (fullscreenmode/resolution) back to the last user confirmed values

Public function Virtual

void

 

RunHardwareBenchmark

(
    int32 WorkScale,
    float CPUMultiplier,
    float GPUMultiplier
)

Runs the hardware benchmark and populates ScalabilityQuality as well as the last benchmark results config members, but does not apply the settings it determines.

Public function Virtual

void

 

SaveSettings()

Save the user settings to persistent storage (automatically happens as part of ApplySettings)

Public function

void

 

SetAntiAliasingQuality

(
    int32 Value
)

Sets the anti-aliasing quality (0..4, higher is better)

Public function

void

 

SetAudioQualityLevel

(
    int32 QualityLevel
)

Sets the user's audio quality level setting

Public function

void

 

SetBenchmarkFallbackValues()

Set scalability settings to sensible fallback values, for use when the benchmark fails or potentially causes a crash

Public function

void

 

SetDynamicResolutionEnabled

(
    bool bEnable
)

Sets the user setting for dynamic resolution.

Public function

void

 

SetFoliageQuality

(
    int32 Value
)

Sets the foliage quality (0..4, higher is better)

Public function

void

 

SetFrameRateLimit

(
    float NewLimit
)

Sets the user's frame rate limit (0 will disable frame rate limiting)

Protected function Static

void

 

SetFrameRateLimitCVar

(
    float InLimit
)

Sets the frame rate limit CVar to the passed in value, 0.0 indicates no limit

Public function

void

 

SetFullscreenMode

(
    EWindowMode::Type InFullscreenMode
)

Sets the user setting for the game window fullscreen mode.

Public function Virtual

void

 

SetOverallScalabilityLevel

(
    int32 Value
)

Changes all scalability settings at once based on a single overall quality level

Public function

void

 

SetPostProcessingQuality

(
    int32 Value
)

Sets the post-processing quality (0..4, higher is better)

Public function

void

 

SetResolutionScaleNormalized

(
    float NewScaleNormalized
)

Sets the current resolution scale as a normalized 0..1 value between MinScaleValue and MaxScaleValue.

Public function

void

 

SetResolutionScaleValueEx

(
    float NewScaleValue
)

Sets the current resolution scale.

Public function

void

 

SetScreenResolution

(
    FIntPoint Resolution
)

Sets the user setting for game screen resolution, in pixels.

Public function

void

 

SetShadingQuality

(
    int32 Value
)

Sets the shading quality (0..4, higher is better)

Public function

void

 

SetShadowQuality

(
    int32 Value
)

Sets the shadow quality (0..4, higher is better)

Protected function Static

void

 

SetSyncTypeCVar

(
    int32 InInterval
)

Sets the input latency mode 0 and 2

Public function

void

 

SetTextureQuality

(
    int32 Value
)

Sets the texture quality (0..4, higher is better)

Public function Virtual

void

 

SetToDefaults()

Public function

void

 

SetViewDistanceQuality

(
    int32 Value
)

Sets the view distance quality (0..4, higher is better)

Public function

void

 

SetVisualEffectQuality

(
    int32 Value
)

Sets the visual effects quality (0..4, higher is better)

Public function

void

 

SetVSyncEnabled

(
    bool bEnable
)

Sets the user setting for vsync.

Public function Virtual

void

 

SetWindowPosition

(
    int32 WindowPosX,
    int32 WindowPosY
)

Public function Virtual Const

bool

 

SupportsHDRDisplayOutput()

Whether the curently running system supports HDR display output

Protected function

void

 

UpdateResolutionQuality()

Protected function Virtual

void

 

UpdateVersion()

Update the version of the game user settings to the current version

Public function Virtual

void

 

ValidateSettings()

Validates and resets bad user settings to default. Deletes stale user settings file if necessary.

Deprecated Functions

Name Description

Public function Const

void

 

GetResolutionScaleInformation

(
    float& CurrentScaleNormalized,
    int32& CurrentScaleValue,
    int32& MinScaleValue,
    int32& MaxScaleValue
)

Please call GetResolutionScaleInformationEx

Public function Static

int32

 

GetSyncInterval()

Please use GetFramePace to get the paced frame rate

Public function

void

 

SetResolutionScaleValue

(
    int32 NewScaleValue
)

Please call SetResolutionScaleValueEx

Protected function Static

void

 

SetSyncIntervalCVar

(
    int32 InInterval
)

Please use FPlatformRHIFramePacer::SetFramePace to set the desired frame rate

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss