Class InstallSizeProbe
Measures how much disk space the installation occupies, without blocking the launcher.
public static class InstallSizeProbe
- Inheritance
-
InstallSizeProbe
- Inherited Members
Remarks
The walk runs on a thread-pool thread. EnumerateFiles(string, string, SearchOption) and Length are plain .NET and safe off the main thread — no Unity API is touched from the worker, which would throw. Only the completed total crosses back, and it is delivered from a coroutine so callers stay on the main thread and can touch UI freely.
A full client install is tens of thousands of files. Doing this synchronously would freeze the launcher for seconds at startup, and doing it per-frame would keep a core busy for a readout nobody is watching — so it runs once, on request, and the result is cached.
Properties
CachedSizeBytes
Last successfully measured size in bytes, or null when never measured.
public static long? CachedSizeBytes { get; }
Property Value
- long?
Methods
Invalidate()
Discards the cached total so the next Measure(string, Action<long?>) re-walks the tree. Call after a patch has been applied.
public static void Invalidate()
Measure(string, Action<long?>)
Measures rootPath and reports the result.
public static IEnumerator Measure(string rootPath, Action<long?> onComplete)
Parameters
rootPathstringDirectory to measure, typically the install root.
onCompleteAction<long?>Invoked on the main thread with the total in bytes, or null when the size could not be determined. Never invoked with a partial total.