UQuickGameModeOverrideSettings (C++)
The settings UObject that holds the override state and persists it to the config file.
The settings object that holds the override state. A plain UObject
(not UDeveloperSettings), so it doesn't appear in Project
Settings — its only UI is the
toolbar widget.
- Header:
Source/QuickGameModeOverride/Public/QuickGameModeOverrideSettings.h - Module:
QuickGameModeOverride(Runtime)
UCLASS(Config="QuickGameModeOverride", DefaultConfig)
class QUICKGAMEMODEOVERRIDE_API UQuickGameModeOverrideSettings : public UObject
{
GENERATED_BODY()
public:
void SaveDefault()
{
SaveConfig(CPF_Config, *GetDefaultConfigFilename());
}
UPROPERTY(EditDefaultsOnly, Config, Category="Quick Game Mode Override")
TOptional<TSubclassOf<AGameModeBase>> OverrideGameModeClass;
UPROPERTY(EditDefaultsOnly, Config, Category="Quick Game Mode Override")
bool bOverrideGameMode = false;
};Properties
bOverrideGameMode
bool, defaults to false. The master switch. The override only
takes effect when this is true and OverrideGameModeClass is
set.
OverrideGameModeClass
TOptional<TSubclassOf<AGameModeBase>>. The target class. Storing it
as TOptional lets the absence of a value persist without writing
OverrideGameModeClass=None to the config file.
The check used everywhere in the plugin is:
if (Settings->bOverrideGameMode && Settings->OverrideGameModeClass.IsSet())
{
if (TSubclassOf<AGameModeBase> Override = Settings->OverrideGameModeClass.GetValue())
{
// ...
}
}The triple guard (bool, IsSet, truthy class) is intentional — the
toolbar UI clears the optional when the user picks None, but a
hand-edited config could still have the bool set without a class.
SaveDefault()
Inline helper that calls SaveConfig(CPF_Config, *GetDefaultConfigFilename())
to persist to Config/DefaultQuickGameModeOverride.ini. The toolbar
calls this after every value change so edits survive editor restarts.
There's no async or delayed write — SaveConfig is synchronous and
hits disk immediately.
Reading the settings
const UQuickGameModeOverrideSettings* Settings = GetDefault<UQuickGameModeOverrideSettings>();GetDefault is sufficient — Config properties are loaded into the
CDO at startup. There's no instance to construct.
Mutating the settings from C++
UQuickGameModeOverrideSettings* Settings = GetMutableDefault<UQuickGameModeOverrideSettings>();
Settings->bOverrideGameMode = true;
Settings->OverrideGameModeClass = TSubclassOf<AGameModeBase>(MyGameModeClass);
Settings->SaveDefault();Use GetMutableDefault (not GetDefault) when you intend to write,
and call SaveDefault() afterward — otherwise the change exists only
in memory for the current editor session.
Not Blueprint-exposed
The class has no BlueprintType / BlueprintReadable markers and
none of its properties are BlueprintReadWrite. There is no
Blueprint API for this plugin's settings.