Class SystemUpdaterLauncher
Starts the standalone updater executable and hands control over to it.
public class SystemUpdaterLauncher : IUpdaterLauncher
- Inheritance
-
SystemUpdaterLauncher
- Implements
- Inherited Members
Remarks
The updater takes ownership of the install as soon as it starts: its first action is to terminate this process (it is given our PID) so that the client binaries are not in use while they are patched, and its last action is to relaunch the client. This launcher therefore must NOT wait for the updater to exit — doing so is a mutual wait that the updater resolves by killing us, which makes every completion callback unreachable dead code.
Instead we watch the updater only long enough to catch a fast failure (missing runtime, bad arguments, unreadable patch), then report success and let the caller shut the launcher down cleanly. If the updater is still running at the end of that window it has gotten far enough to own the handoff.
Methods
LaunchUpdater(string, string, string, string, Action, Action<string>)
Launches the updater executable and hands off to it via a coroutine, ensuring callbacks execute on the Unity main thread.
IMPORTANT: This method returns an IEnumerator and the caller
MUST invoke it via MonoBehaviour.StartCoroutine. The implementation
uses yield return new WaitForSeconds(...) which requires a Unity
coroutine host with a main-thread UnitySynchronizationContext. Calling this
method outside of a Unity coroutine context will result in undefined behavior.
onComplete means "the updater is running and owns the
install from here" — NOT "the patch has been applied". The caller should shut
the launcher down promptly so the updater can replace the client binaries.
public IEnumerator LaunchUpdater(string updaterPath, string currentClientVersion, string latestServerVersion, string patchesDirectory, Action onComplete, Action<string> onError)
Parameters
updaterPathstringPath to the updater executable.
currentClientVersionstringCurrent client version string.
latestServerVersionstringLatest server version string.
patchesDirectorystringDirectory the patch archive was downloaded into.
onCompleteActionCallback invoked once the updater has started successfully and taken over.
onErrorAction<string>Callback invoked when updater fails to start or exits with an error before handoff.
Returns
- IEnumerator
An IEnumerator for use in a Unity Coroutine.