Class HttpPatchServerService
Unity-backed patch service implementation for endpoint discovery, version checks, and patch downloads.
public class HttpPatchServerService : MonoBehaviour, IPatchServerService
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourHttpPatchServerService
- Implements
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Properties
MaxRetries
Maximum number of retries for each web request.
public int MaxRetries { get; }
Property Value
RetryDelay
Delay in seconds between retries for web requests.
public float RetryDelay { get; }
Property Value
WebRequestService
Service for handling Unity web requests.
public UnityWebRequestService WebRequestService { get; }
Property Value
WebRequestTimeout
Timeout in seconds for each individual web request.
public int WebRequestTimeout { get; }
Property Value
Methods
DownloadPatch(string, string, string, long, Action<bool>, Action<string>, Action<DownloadStats>)
Downloads a patch file from the given URL to a temporary file path, reporting progress and completion via callbacks.
When expectedSha256 is non-empty, the downloaded file is
hashed after the transfer completes and the operation fails if the digest
does not match (the partial file is deleted).
public IEnumerator DownloadPatch(string patchUrl, string destinationFilePath, string expectedSha256, long expectedTotalBytes, Action<bool> onComplete, Action<string> onError, Action<DownloadStats> onProgress)
Parameters
patchUrlstringThe URL to download the patch from.
destinationFilePathstringFull path (including file name) to save the patch archive to.
expectedSha256stringLowercase hex SHA-256 the downloaded file must match, or null/empty to skip verification.
expectedTotalByteslongExpected size from the version manifest, or 0 when unknown.
onCompleteAction<bool>Callback for successful download. The argument is false when the server reported the client is already up to date.
onErrorAction<string>Callback for error handling.
onProgressAction<DownloadStats>Callback for progress updates.
Returns
- IEnumerator
Coroutine enumerator.
GetLatestVersion(string, string, Action<VersionConfig, PatchInfo>, Action<string>)
Fetches the latest version from the API gateway and returns it via callback.
Also returns optional per-version PatchInfo (SHA-256, size,
availability) when clientVersion is supplied.
public IEnumerator GetLatestVersion(string apiHost, string clientVersion, Action<VersionConfig, PatchInfo> onComplete, Action<string> onError)
Parameters
apiHoststringThe unified API host URL.
clientVersionstringClient's current version string, or null/empty.
onCompleteAction<VersionConfig, PatchInfo>Callback for successful version fetch.
onErrorAction<string>Callback for error handling.
Returns
- IEnumerator
Coroutine enumerator.
Remarks
Manifest integrity (was the TODO above this method; S4). The response
is verified with Ed25519 against
GeneratedPinSet.VersionManifestPublicKeyBase64 before ANY field in it is
read. That matters because the manifest is trusted absolutely downstream: its
sha256 is the only integrity check applied to the patch archive, so whoever
writes the manifest chooses which bytes the updater installs, and its
latest_version becomes part of a file path. TLS authenticates the transport
and nothing else — it says nothing about a compromised gateway, a mis-issued
certificate, or a CDN edge serving a substituted document.
Fail-closed, with one deliberate exception. When a verification key is embedded, a manifest that does not verify is discarded and the version check fails — no partial trust, no "use it but warn". When NO key is embedded, signing is not configured for this deployment: the client falls back to the previous SHA-256-over-pinned-TLS posture and says so at Error level on every check in a release build. That exception exists so operators can adopt signing without every existing install breaking the moment this ships; it is loud precisely so it does not become the permanent state. The editor build validator reports the same thing at build time.