Class LauncherSettings
Typed access to the launcher's persisted settings, stored in the shared GlobalSettings file alongside the game's other options.
public static class LauncherSettings
- Inheritance
-
LauncherSettings
- Inherited Members
Remarks
The launcher has to load the configuration itself. Only the in-game Options panels did so previously, and those live in the world scene — by the time either runs, the launcher has long since finished. Nothing had read a settings file at launcher time before this.
Every getter clamps. These values reach the network layer, and the file is plain text a player can edit: a timeout of 0 or a retry count of 100000 would otherwise be honoured literally, and the failure would look like a launcher bug rather than a bad config.
Fields
KeyAutoUpdate
Start downloading an available update without asking first.
public const string KeyAutoUpdate = "Launcher.AutoUpdate"
Field Value
KeyMaxRetries
Retry attempts after an initial request failure.
public const string KeyMaxRetries = "Launcher.MaxRetries"
Field Value
KeyPatchDirectory
Override for where patch archives are downloaded to and read from.
public const string KeyPatchDirectory = "Launcher.PatchDirectory"
Field Value
KeyRequestTimeout
Per-request timeout, in seconds.
public const string KeyRequestTimeout = "Launcher.RequestTimeout"
Field Value
KeyRetryDelay
Delay between retries, in seconds.
public const string KeyRetryDelay = "Launcher.RetryDelay"
Field Value
KeyUpdateAttemptCount
How many times that update has been handed to the updater.
public const string KeyUpdateAttemptCount = "Launcher.UpdateAttemptCount"
Field Value
KeyUpdateAttemptVersion
Target version of the update currently being retried.
public const string KeyUpdateAttemptVersion = "Launcher.UpdateAttemptVersion"
Field Value
KeyWindowHeight
Last window height the player used.
public const string KeyWindowHeight = "Launcher.WindowHeight"
Field Value
KeyWindowWidth
Last window width the player used.
public const string KeyWindowWidth = "Launcher.WindowWidth"
Field Value
MaxConsecutiveUpdateAttempts
How many automatic attempts at the same update are made before the launcher stops starting them on its own.
public const int MaxConsecutiveUpdateAttempts = 3
Field Value
Remarks
Three: enough to ride out a transient failure (a half-written archive, a file the antivirus had open, a machine that lost power mid-apply), few enough that a genuinely broken upgrade path does not cost the player an unbounded number of multi-gigabyte downloads.
MaxRequestTimeout
public const int MaxRequestTimeout = 300
Field Value
MaxRetriesLimit
public const int MaxRetriesLimit = 10
Field Value
MaxRetryDelay
public const float MaxRetryDelay = 30
Field Value
MinRequestTimeout
Bounds for GetRequestTimeout(int), in seconds.
public const int MinRequestTimeout = 5
Field Value
MinRetries
Bounds for GetMaxRetries(int).
public const int MinRetries = 0
Field Value
MinRetryDelay
Bounds for GetRetryDelay(float), in seconds.
public const float MinRetryDelay = 0
Field Value
Properties
AutoUpdate
Whether an available update starts downloading automatically.
public static bool AutoUpdate { get; set; }
Property Value
Remarks
Defaults to true because that is what the launcher has always done — an out-of-date client begins patching the moment the version check finishes. Turning it off makes the launcher stop and offer an Update button instead. Changing the default would silently alter behaviour for every existing install.
PatchDirectoryOverride
Where patch archives are stored, or empty to use the install's own Patches folder.
public static string PatchDirectoryOverride { get; set; }
Property Value
Remarks
This is not a "move the game" setting and cannot be one: the updater patches files relative to its own location and ships beside the client binaries, so the install root is fixed by construction. What it does allow is keeping the archives — which are large and transient — off a small system drive.
Whatever this resolves to has to be the same folder on both sides. The launcher downloads here and passes the resolved path to the updater explicitly rather than letting both derive it, because a disagreement is silent: the updater finds no archive, does nothing, and relaunches the client at the same version forever.
Methods
ClearUpdateAttempts()
Clears the attempt counter. Called once the client is confirmed to be at the server's version — the only evidence that an update actually landed.
public static void ClearUpdateAttempts()
EnsureLoaded()
Loads the global configuration if nothing has loaded it yet.
public static void EnsureLoaded()
Remarks
Mirrors UITKOptions.EnsureConfigurationLoaded so the launcher and the in-game
Options panel agree about where settings live and cannot end up with two stores.
GetMaxRetries(int)
Retry attempts after an initial failure, or fallback when unset.
public static int GetMaxRetries(int fallback)
Parameters
fallbackint
Returns
GetRequestTimeout(int)
Per-request timeout in seconds, or fallback when unset.
public static int GetRequestTimeout(int fallback)
Parameters
fallbackint
Returns
GetRetryDelay(float)
Delay between retries in seconds, or fallback when unset.
public static float GetRetryDelay(float fallback)
Parameters
fallbackfloat
Returns
GetWindowSize(int, int)
Remembers the launcher window size, or (0, 0) when the player has not resized it.
public static Vector2Int GetWindowSize(int minWidth, int minHeight)
Parameters
Returns
- Vector2Int
Remarks
Clamped against the current display so a window saved on a larger monitor cannot come back bigger than the screen it is now opening on — which would put the footer buttons off the bottom with no way to reach them.
HasExhaustedUpdateAttempts(string)
True when targetVersion has already been attempted
MaxConsecutiveUpdateAttempts times without the client reaching it.
public static bool HasExhaustedUpdateAttempts(string targetVersion)
Parameters
targetVersionstring
Returns
Remarks
Only automatic updates are gated on this. A player who presses Update anyway has made a decision, and one more attempt at their request is not a loop.
RecordUpdateAttempt(string)
Records that an update to targetVersion is about to be handed to
the updater, and returns which attempt this is (1 for the first).
public static int RecordUpdateAttempt(string targetVersion)
Parameters
targetVersionstring
Returns
Remarks
This exists because the failure it guards against is invisible from inside a single run. The updater's first action is to terminate this process, so when a patch fails AFTER that point there is no launcher left to be told: the updater rolls back, relaunches the client at the unchanged version, the launcher checks again, finds the same mismatch, and — with auto-update on — downloads and applies the same archive again. Nothing in that cycle is an error from any single participant's point of view, and it repeats forever.
Written and flushed BEFORE the handoff for the same reason: anything recorded after it never gets written, because the process is gone.
ResolvePatchDirectory(string)
Returns the directory patch archives should be written to and read from.
public static string ResolvePatchDirectory(string defaultDirectory)
Parameters
defaultDirectorystringThe install's own Patches folder, used when no override is set or the override is unusable.
Returns
Remarks
Creates the directory if it does not exist — the player is naming a location, not promising to have made it. Any failure falls back to the default rather than propagating: the override is a convenience, and an unusable one should cost the convenience, not the update. The updater applies the same rule, so both sides land on the default together.
Save()
Persists settings to disk. Best-effort — a read-only install directory must not be a fatal error for a launcher that otherwise works.
public static void Save()
Remarks
Through ClientSettings rather than by calling Save on the store
directly. The launcher shares one Configuration with the rest of the
client, and a second writer that reached the file by its own route bypassed two things
every other write honours: the editor guard, so a play-mode launcher session rewrote the
developer's checked-out Configuration.cfg, and the WebGL sync, so a launcher setting was
written into an in-memory filesystem and lost on the next page load. It also left the
client's pending-write flag set, so the same file was serialised again moments later.
Still immediate rather than debounced: the launcher writes at deliberate moments — a field committed, an update attempt recorded — and the process it is about to hand over to may not be this one.
SetMaxRetries(int)
public static void SetMaxRetries(int value)
Parameters
valueint
SetRequestTimeout(int)
public static void SetRequestTimeout(int value)
Parameters
valueint
SetRetryDelay(float)
public static void SetRetryDelay(float value)
Parameters
valuefloat
SetWindowSize(int, int)
Records the launcher window size.
public static void SetWindowSize(int width, int height)