GameUserSettingsClassName

GameUserSettingsClassName

#Overview

name: GameUserSettingsClassName

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of GameUserSettingsClassName is to specify the class name for the Game User Settings, which can be customized to support game-specific options for Graphics, Sound, and Gameplay.

This setting variable is primarily used within the Engine subsystem of Unreal Engine 5. It’s referenced in core engine files such as Engine.h, GameEngine.cpp, GameUserSettings.cpp, and UnrealEngine.cpp.

The value of this variable is set in the engine configuration files. It can be modified through the engine’s global configuration settings, typically in the DefaultEngine.ini file under the [/Script/Engine.Engine] section.

GameUserSettingsClassName interacts with other variables, particularly GameUserSettingsClass, which is the actual class object derived from the class name specified by GameUserSettingsClassName. It’s also used in conjunction with configuration reading and writing operations involving GConfig.

Developers must be aware that changing this variable requires a restart of the engine to take effect, as indicated by the meta tag “ConfigRestartRequired=true” in the property declaration.

Best practices when using this variable include:

  1. Only modify it if you need to implement custom game-specific user settings.
  2. Ensure the specified class inherits from UGameUserSettings.
  3. Make changes to this variable early in the project setup, as it requires an engine restart.
  4. Be consistent with the naming convention when specifying a custom class (e.g., “/Script/YourGameModule.YourCustomGameUserSettings”).
  5. Remember to implement and override necessary functions in your custom GameUserSettings class to handle the new game-specific options.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:134, section: [/Script/Engine.Engine]

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:29, section: [/Script/Engine.Engine]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:834

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** Sets the GameUserSettings class, which can be overridden to support game-specific options for Graphics/Sound/Gameplay. */
	UPROPERTY(globalconfig, noclear, EditAnywhere, Category=DefaultClasses, meta=(MetaClass="/Script/Engine.GameUserSettings", DisplayName="Game User Settings Class", ConfigRestartRequired=true), AdvancedDisplay)
	FSoftClassPath GameUserSettingsClassName;

	UPROPERTY()
	TSubclassOf<class UGameUserSettings> GameUserSettingsClass;

	/** Global instance of the user game settings */
	UPROPERTY()

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameEngine.cpp:561

Scope: file

Source code excerpt:

		FString ScriptEngineCategory = TEXT("/Script/Engine.Engine");
		FString GameUserSettingsCategory = TEXT("/Script/Engine.GameUserSettings");
		GConfig->GetString(*ScriptEngineCategory, TEXT("GameUserSettingsClassName"), GameUserSettingsCategory, GEngineIni);
		if (GConfig->GetInt(*GameUserSettingsCategory, TEXT("WindowPosX"), WinX, GGameUserSettingsIni) &&
			GConfig->GetInt(*GameUserSettingsCategory, TEXT("WindowPosY"), WinY, GGameUserSettingsIni))
		{
			AutoCenterType = EAutoCenter::None;
		}
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameUserSettings.cpp:646

Scope (from outer to inner):

file
function     void UGameUserSettings::PreloadResolutionSettings

Source code excerpt:

	FString GameUserSettingsCategory = TEXT("/Script/Engine.GameUserSettings");

	GConfig->GetString(*ScriptEngineCategory, TEXT("GameUserSettingsClassName"), GameUserSettingsCategory, GEngineIni);

	int32 ResolutionX = GetDefaultResolution().X;
	int32 ResolutionY = GetDefaultResolution().Y;
	EWindowMode::Type WindowMode = GetDefaultWindowMode();
	bool bUseDesktopResolution = false;
	bool bUseHDR = FPlatformMisc::UseHDRByDefault();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:3231

Scope (from outer to inner):

file
function     void UEngine::InitializeObjectReferences

Source code excerpt:

		LoadEngineClass<UAvoidanceManager>(AvoidanceManagerClassName, AvoidanceManagerClass);
	}
	LoadEngineClass<UGameUserSettings>(GameUserSettingsClassName, GameUserSettingsClass);
	LoadEngineClass<ALevelScriptActor>(LevelScriptActorClassName, LevelScriptActorClass);

	// It is valid for physics collision handler to be None
	if (PhysicsCollisionHandlerClassName.IsValid())
	{
		LoadEngineClass<UPhysicsCollisionHandler>(PhysicsCollisionHandlerClassName, PhysicsCollisionHandlerClass);