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.

Abgeändertes Beispiel für die Fachhochschule Wedel.

Inheritance Hierarchy

References

Module

Engine

Header

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

Implementation

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

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.

Functions

Name Description

Public function Virtual

void

 

ApplyHardwareBenchmarkResults()

Public function Virtual

void

 

ApplyNonResolutionSettings()

Public function

void

 

ApplyResolutionSettings

(
    bool bCheckForCommandLineOverrides
)

Public function Virtual

void

 

ApplySettings

(
    bool bCheckForCommandLineOverrides
)

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
)

Protected function

float

 

FindResolutionQualityForScreenSize

(
    float Width,
    float Height
)

Public function Const

int32

 

GetAntiAliasingQuality()

Public function Const

int32

 

GetAudioQualityLevel()

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

(
    bool bAllowCmdLineOverrides
)

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