Skip to main content
Version: v3

AssetPatcher

Important Attention Reminder

Coding Style wiki


AssetPatcher is the unified patch-update entry point (Facade) of the AssetLoader module, powered by YooAsset underneath. It covers patch flow control (check, repair, pause, resume, cancel), package lifecycle management (initialization, update, unloading, default-package switching), downloader creation with multi-package combined downloads, plus version, state, and path queries.

NamespaceOxGFrame.AssetLoader
Typepublic static class
SourceAssetPatcher.cs
using OxGFrame.AssetLoader;
using OxGFrame.AssetLoader.Bundle; // for PackageInfoWithBuild, BundleConfig.PlayMode, etc.

Attention A PatchLauncher must be set up in the startup scene beforehand (it configures the PlayMode, preset packages, and download options). See the AssetLoader Introduction for setup details.

Quick Start

// Start the patch check flow (version comparison -> manifest update -> main downloader -> download)
AssetPatcher.Check();

// Once the patch flow completes, assets can be loaded
while (!AssetPatcher.IsDone())
await UniTask.Yield();

// Initialize a DLC package and update its version and manifest
bool success = await AssetPatcher.InitDlcPackage(new DlcPackageInfoWithBuild()
{
packageName = "Dlc01Package",
dlcVersion = "v1.0"
}, updatePackage: true);

// Switch the default package (used by AssetLoaders when no packageName is given)
AssetPatcher.SwitchDefaultPackage("Dlc01Package");

// Query the current patch version
string patchVersion = AssetPatcher.GetPatchVersion();

General Rules

Package Concept

OxGFrame manages assets in units of packages (YooAsset ResourcePackage):

TypeDescription
App PackageMain asset package whose remote path follows the app version.
DLC PackageExtension package with an independent version path (dlcVersion); can be initialized and unloaded on demand.
  • Preset Packages: the package lists (App and DLC) configured on the PatchLauncher Inspector. They are initialized automatically on startup (Awake) and combined into the main download of the patch flow; the first App package in the list becomes the default package.
  • Default package: whenever an AssetLoaders method is called without a packageName, the default package is used (changeable via SetDefaultPackage / SwitchDefaultPackage).
  • Fields of the package info base class PackageInfoWithBuild:
FieldTypeDescription
buildModeBundleConfig.BuildModeBuild pipeline (EditorSimulateMode only): ScriptableBuildPipeline / BuiltinBuildPipeline / RawFileBuildPipeline.
packageNamestringPackage name.
hostServerstringCustom host server URL (assembled automatically from the config when empty).
fallbackHostServerstringCustom fallback host server URL (assembled automatically from the config when empty).
initializeParametersInitializeParametersYooAsset initialization parameters (used by CustomMode).

AppPackageInfoWithBuild inherits the fields above as-is; DlcPackageInfoWithBuild additionally adds:

FieldTypeDescription
withoutPlatformboolWhether the DLC remote path skips the platform segment.
Default: false
dlcVersionstringDLC version. When empty, the newest (date-based) version is used automatically.

PlayMode

The BundleConfig.PlayMode configured on the PatchLauncher determines how the asset system runs:

ValueDescription
EditorSimulateModeEditor simulate mode: runs in the editor without actually building AssetBundles.
OfflineModeOffline mode: uses built-in (StreamingAssets) assets only, no remote updates.
HostModeHost mode: connects to the asset server for version checks, manifest updates, and downloads.
WeakHostModeWeak-network host mode: like HostMode, but can keep running with the last recorded local version while offline (local assets must be complete).
WebGLModeWebGL mode: uses the web platform's built-in assets only (WebGL only).
WebGLRemoteModeWebGL remote mode: built-in assets plus a remote asset server (WebGL only).
CustomModeCustom mode: you provide the YooAsset InitializeParameters yourself; preset packages must be configured manually via SetPresetPackages.

Reminder After building, the PlayMode can be overridden with Scripting Define Symbols (OXGFRAME_OFFLINE_MODE, OXGFRAME_HOST_MODE, OXGFRAME_WEAK_HOST_MODE, OXGFRAME_WEBGL_MODE, OXGFRAME_WEBGL_REMOTE_MODE, OXGFRAME_CUSTOM_MODE).

YooAsset Version Compatibility

Since v3.7.0, both YooAsset 2.x (verified with 2.3.18–2.3.19) and YooAsset 3.x (verified with 3.0.3-beta–3.0.5; 3.0.5+ recommended) are supported:

  • YOOASSET_2 (2.x) or YOOASSET_3 (3.x) is defined automatically from the installed com.tuyoogame.yooasset package version — no manual macro setup is needed.
  • The public API signatures are identical under both versions; no project code changes are required — the differences are handled internally by the framework.
  • The custom decryption interface method IDecryptInitialize.CheckIsIntialized() has been renamed to CheckIsInitialized() (only affects custom decryption implementations).
ItemYooAsset 2.xYooAsset 3.x
Initialization & file systemsClassic InitializeParametersNative v3 Options API and the new file systems (handled internally)
BuildMode.ArchiveFileBuildPipeline (BundleConfig)Not supportedSupported (incl. archive-package simulation in EditorSimulateMode)
8 built-in cryptogram servicesSupportedSupported (implementing the v3 split decryption interfaces, plus IBundleEncryptor / IManifestEncryptor on the editor side)
onDownloadError callback typeDownloaderOperation.DownloadErrorSignature-compatible alias Action<DownloadErrorEventArgs> (usage unchanged)
Raw file loadingRawFileHandleRawFileObject / EnsureBundleFileAsync (same behavior)

Patch Flow & Main Downloader

  • Check / Repair start the state-machine-driven patch flow (version comparison → manifest update → downloader creation → download → done). Each stage raises events through PatchEvents for UI progress display and interaction.
  • Pause / Resume / Cancel only affect the main downloader created by the patch flow; downloaders you create yourself via GetPackageDownloader and friends are not affected.
  • Once the flow completes, IsDone returns true and assets can be loaded through AssetLoaders.

DownloadInfo Struct

public struct DownloadInfo

The return type of the GetDownloadInfoWithCombinePackages family, used to pre-compute the pending download totals:

FieldTypeDescription
totalCountintTotal number of files to download.
totalBytesulongTotal number of bytes to download.

Patch Status

Query the current state of the patch and asset system.

Method Overview

MethodDescription
IsInitializedWhether the asset system (preset packages) has finished initializing.
IsReleasedWhether the asset system has been released (Release was called).
IsCheckWhether a patch check flow is currently running.
IsRepairWhether a repair flow is currently running.
IsDoneWhether the patch flow has fully completed.

IsInitialized

public static bool IsInitialized()

Returns

bool — whether all preset packages have finished initializing.

Description

Tells whether the asset system has completed initialization (true after the PatchLauncher startup initialization of preset packages, or after a successful manual InitSetupPresetPackages call).


IsReleased

public static bool IsReleased()

Returns

bool — whether Release has been called.

Description

Tells whether the asset system (YooAsset) has been released. After release, bundle-unloading operations in AssetLoaders are skipped.


IsCheck

public static bool IsCheck()

Returns

bool — whether a patch check flow is currently running.

Description

Tells whether the patch check flow started by Check is in progress (false after the flow completes or is canceled).


IsRepair

public static bool IsRepair()

Returns

bool — whether a repair flow is currently running.

Description

Tells whether the repair flow started by Repair is in progress.


IsDone

public static bool IsDone()

Returns

bool — whether the patch flow has fully completed.

Description

Tells whether the patch flow has completed and asset loading can begin. Reset to false when Check / Repair starts, and set to true when the flow finishes.

Example

AssetPatcher.Check();

while (!AssetPatcher.IsDone())
await UniTask.Yield();

// Patch finished — start loading assets

Patch Operations

Control the patch flow and the main downloader.

Method Overview

Flow Control

MethodDescription
SetPresetPackagesConfigures preset App/DLC packages at runtime (for CustomMode).
InitSetupPresetPackagesInitializes the preset packages manually.
CheckStarts the patch check flow.
RepairStarts the repair flow (clears the local cache and re-downloads).

Main Downloader Control

MethodDescription
PausePauses the main downloader.
ResumeResumes the main downloader.
CancelCancels the main downloader.

SetPresetPackages

public static void SetPresetPackages(List<AppPackageInfoWithBuild> appPackages, List<DlcPackageInfoWithBuild> dlcPackages)

Parameters

ParameterTypeDescription
appPackagesList<AppPackageInfoWithBuild>Preset App package list (the first entry becomes the default package).
dlcPackagesList<DlcPackageInfoWithBuild>Preset DLC package list.

Description

Configures the preset packages at runtime (overriding the lists set on the PatchLauncher).

Reminder Calling this before the PatchLauncher awakes is safe — the values are written to BundleConfig instead, with a warning logged (no exception is thrown).

Attention Intended mainly for CustomMode — in CustomMode the preset lists on the PatchLauncher Inspector are ignored, so configure them with this method and then call InitSetupPresetPackages.

Example

AssetPatcher.SetPresetPackages(
new List<AppPackageInfoWithBuild>()
{
new AppPackageInfoWithBuild() { packageName = "DefaultPackage" }
},
new List<DlcPackageInfoWithBuild>());

await AssetPatcher.InitSetupPresetPackages();

InitSetupPresetPackages

public static async UniTask InitSetupPresetPackages()

Returns

UniTask — an awaitable async operation.

Description

Initializes and sets up all preset packages (App and DLC). On completion, the first App package in the list is set as the default package and the IsInitialized state is updated.

Reminder Normally the PatchLauncher runs this automatically in Awake; call it manually only in CustomMode or when the initializePresetPackages option is disabled.


Check

public static void Check()

Description

Starts the patch check flow: compares the app version, updates package versions and asset manifests, creates the main downloader, and downloads the updated content. Each stage raises events through PatchEvents.

Attention If a check or repair flow is already running, repeated calls are ignored (a warning is logged).

Example

// Start the patch flow
AssetPatcher.Check();

// Wait for completion by polling (or subscribe to PatchEvents)
while (!AssetPatcher.IsDone())
await UniTask.Yield();

Repair

public static void Repair()

Description

Starts the repair flow: clears the local patch cache data and config files (empties the download directory), then reruns the full patch flow. Useful for repairing corrupted or incomplete local assets.

Important Repairing deletes the downloaded local assets — everything must be downloaded again afterwards.


Pause

public static void Pause()

Description

Pauses all download tasks of the patch flow's main downloader. Has no effect when no patch flow is running (no main downloader exists).


Resume

public static void Resume()

Description

Resumes all download tasks of the patch flow's main downloader.


Cancel

public static void Cancel()

Description

Cancels the main downloader's download tasks, raises the cancellation event (PatchEvents.PatchDownloadCanceled), and ends the Check/Repair states.


Version & Platform Info

Method Overview

MethodDescription
GetPlatformGets the current runtime platform name.
GetAppVersionGets the app version.
GetPatchVersionGets the newest patch (asset) version.

GetPlatform

public static string GetPlatform()

Returns

string — the platform name; if the patch flow has not obtained it yet (e.g., simulate mode), Application.platform.ToString() is returned.

Description

Gets the runtime platform name recorded in the patch configuration (from the AppConfig).


GetAppVersion

public static string GetAppVersion()

Returns

string — the app version; if the patch flow has not obtained it yet (e.g., simulate mode), Application.version is returned.

Description

Gets the app version recorded in the patch configuration (from the AppConfig).


GetPatchVersion

public static string GetPatchVersion(bool encode = false, int length = 16, string separator = "-")
public static string GetPatchVersion(string[] customPatchVersions, bool encode = false, int length = 16, string separator = "-")

Parameters

ParameterTypeDescription
customPatchVersionsstring[]Custom version list. If omitted, the patch versions recorded for the preset packages are used.
encodeboolWhether to output an encoded version string (recommended for display).
Default: false
lengthintLength of the encoded string (valid range 11–32).
Default: 16
separatorstringSeparator of the encoded string.
Default: "-"

Returns

string — the newest patch version string; if no version record exists (e.g., simulate mode), a version generated from the current date is returned.

Description

Gets the newest patch (asset) version among the version list. With encode = true, an encoded display string is returned.

Example

// Raw version string
string version = AssetPatcher.GetPatchVersion();

// Encoded display version
string display = AssetPatcher.GetPatchVersion(encode: true);

Package Management

Manage package initialization, updating, queries, default switching, and unloading.

Method Overview

Initialization & Update

MethodDescription
InitPackageInitializes an App or DLC package automatically based on the info type.
InitAppPackageInitializes an App package.
InitDlcPackageInitializes a DLC package.
UpdatePackageUpdates the version and manifest of a package.

Default Package

MethodDescription
SetDefaultPackageSets the default package (auto-registers when not registered).
SwitchDefaultPackageSwitches the default among registered packages.
GetDefaultPackageNameGets the default package name.
GetDefaultPackageGets the default package instance.

Package Getters

MethodDescription
GetPackageGets a package by name.
GetPackagesGets packages by names in batch.
GetAllPackagesGets all registered packages.
GetPresetAppPackagesGets the preset App packages.
GetPresetDlcPackagesGets the preset DLC packages.
GetPresetAppPackageInfosGets the preset App package info list.
GetPresetAppPackageNamesGets the preset App package name list.
GetPresetDlcPackageInfosGets the preset DLC package info list.
GetPresetDlcPackageNamesGets the preset DLC package name list.

Local File Query & Unload

MethodDescription
CheckPackageHasAnyFilesInLocalChecks whether the package has any files in the local sandbox.
GetPackageSizeInLocalGets the total file size of the package in the local sandbox.
UnloadPackageUnloads (destroys) the package from memory.
UnloadPackageAndClearCacheFilesUnloads the package and clears its cache files from the local sandbox.

InitPackage

public static async UniTask<bool> InitPackage(PackageInfoWithBuild packageInfo, bool updatePackage = false)

Parameters

ParameterTypeDescription
packageInfoPackageInfoWithBuildPackage info (AppPackageInfoWithBuild or DlcPackageInfoWithBuild).
updatePackageboolWhether to update the version and manifest right after successful initialization.
Default: false

Returns

UniTask<bool> — whether initialization (and the optional update) succeeded; false when packageInfo is neither an App nor a DLC info type.

Description

Dispatches automatically to InitAppPackage or InitDlcPackage based on the runtime type of packageInfo.


InitAppPackage

public static async UniTask<bool> InitAppPackage(AppPackageInfoWithBuild packageInfo, bool updatePackage = false)

Parameters

ParameterTypeDescription
packageInfoAppPackageInfoWithBuildApp package info (see Package Concept for the fields).
updatePackageboolWhether to update the version and manifest right after successful initialization.
Default: false

Returns

UniTask<bool> — whether initialization (and the optional update) succeeded.

Description

Registers the package and initializes it according to the current PlayMode. With autoConfigureServerEndpoints enabled (a PlayMode parameter), the host and fallback server URLs are assembled automatically from the configuration (used by the host-mode family).

Attention
  • An already-initialized package is not re-initialized; only the optional update (per updatePackage) is performed.
  • Modern YooAsset requires the version and manifest before assets can be loaded, so the startup flow always initializes preset packages with updatePackage = true.

Example

bool success = await AssetPatcher.InitAppPackage(new AppPackageInfoWithBuild()
{
packageName = "OtherPackage"
}, updatePackage: true);

InitDlcPackage

public static async UniTask<bool> InitDlcPackage(DlcPackageInfoWithBuild packageInfo, bool updatePackage = false)

Parameters

ParameterTypeDescription
packageInfoDlcPackageInfoWithBuildDLC package info (includes dlcVersion and withoutPlatform; see Package Concept).
updatePackageboolWhether to update the version and manifest right after successful initialization.
Default: false

Returns

UniTask<bool> — whether initialization (and the optional update) succeeded.

Description

Registers the package and initializes it according to the current PlayMode. If packageInfo.hostServer / fallbackHostServer are set they take precedence; otherwise (with autoConfigureServerEndpoints enabled) the URLs are assembled from the DLC path rules (including dlcVersion and withoutPlatform).

Example

// Initialize a DLC package pinned to a fixed version
bool success = await AssetPatcher.InitDlcPackage(new DlcPackageInfoWithBuild()
{
packageName = "Dlc01Package",
dlcVersion = "v1.0"
}, updatePackage: true);

// Leave dlcVersion empty to use the newest (date-based) version automatically
await AssetPatcher.InitDlcPackage(new DlcPackageInfoWithBuild()
{
packageName = "Dlc02Package",
dlcVersion = null
}, updatePackage: true);

UpdatePackage

public static async UniTask<bool> UpdatePackage(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

UniTask<bool> — whether the version request and manifest update succeeded.

Description

Requests the newest version of the package from the server and updates its asset manifest; on success the version is recorded locally.

Reminder In weak-network mode (with enableLastLocalVersionsCheckInWeakNetwork enabled), if the version request fails, the last recorded local version is used to update the manifest and the local content is verified for completeness (returns false when incomplete — a network connection is required).


SetDefaultPackage

public static void SetDefaultPackage(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Description

Sets the given package as the default package; if the package is not registered yet, it is registered automatically first.

Attention Auto-registration is not initialization — a newly registered package still needs to go through InitPackage before assets can be loaded from it.


SwitchDefaultPackage

public static void SwitchDefaultPackage(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Description

Switches the default package among the registered packages. If the name is not found, an error is logged and nothing changes.

Example

// Make the DLC package the default
AssetPatcher.SwitchDefaultPackage("Dlc01Package");

// From now on, AssetLoaders calls without a packageName use Dlc01Package
var prefab = await AssetLoaders.LoadAssetAsync<GameObject>("DlcShopUI");

GetDefaultPackageName

public static string GetDefaultPackageName()

Returns

string — the name of the current default package.

Description

Gets the package name currently used by default when loading assets.


GetDefaultPackage

public static ResourcePackage GetDefaultPackage()

Returns

ResourcePackage — the current default package instance (YooAsset).

Description

Gets the default package instance, usable with the downloader family of methods.


GetPackage

public static ResourcePackage GetPackage(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

ResourcePackage — the package matching the name; null when the name is empty or not found.

Description

Gets a registered package instance by name.


GetPackages

public static ResourcePackage[] GetPackages(params string[] packageNames)

Parameters

ParameterTypeDescription
packageNamesstring[]Package name list (params).

Returns

ResourcePackage[] — the packages found (missing ones are skipped); null when the input list is empty.

Description

Gets registered package instances by names in batch.


GetAllPackages

public static ResourcePackage[] GetAllPackages()

Returns

ResourcePackage[] — all registered packages.

Description

Gets all package instances currently registered.


GetPresetAppPackages

public static ResourcePackage[] GetPresetAppPackages()

Returns

ResourcePackage[] — the preset App package instances (unregistered ones are skipped); an empty array when the list is empty.

Description

Gets the preset App package instances configured on the PatchLauncher.

Example

// Download the updates of all preset App packages combined
var packages = AssetPatcher.GetPresetAppPackages();
bool succeed = await AssetPatcher.BeginDownloadWithCombinePackages(packages);

GetPresetDlcPackages

public static ResourcePackage[] GetPresetDlcPackages()

Returns

ResourcePackage[] — the preset DLC package instances (unregistered ones are skipped); an empty array when the list is empty.

Description

Gets the preset DLC package instances configured on the PatchLauncher.


GetPresetAppPackageInfos

public static PackageInfoWithBuild[] GetPresetAppPackageInfos()

Returns

PackageInfoWithBuild[] — the preset App package info list.

Description

Gets the preset App package infos (name, build pipeline, etc.) configured on the PatchLauncher.


GetPresetAppPackageNames

public static string[] GetPresetAppPackageNames()

Returns

string[] — the preset App package names.

Description

Gets the preset App package names configured on the PatchLauncher.


GetPresetDlcPackageInfos

public static DlcPackageInfoWithBuild[] GetPresetDlcPackageInfos()

Returns

DlcPackageInfoWithBuild[] — the preset DLC package info list.

Description

Gets the preset DLC package infos (name, version, etc.) configured on the PatchLauncher.


GetPresetDlcPackageNames

public static string[] GetPresetDlcPackageNames()

Returns

string[] — the preset DLC package names.

Description

Gets the preset DLC package names configured on the PatchLauncher.


CheckPackageHasAnyFilesInLocal

public static bool CheckPackageHasAnyFilesInLocal(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

bool — whether the package has any files in its local sandbox directory; false when the package or the directory does not exist.

Description

Checks whether the package has files downloaded locally — useful to tell whether a DLC has been downloaded.

Reminder Always returns true in EditorSimulateMode.


GetPackageSizeInLocal

public static ulong GetPackageSizeInLocal(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

ulong — the total file size (bytes) of the package in the local sandbox; 0 when the package or the directory does not exist.

Description

Sums the file sizes of the package in its local sandbox directory.

Reminder Always returns 1 in EditorSimulateMode.


UnloadPackage

public static async UniTask<bool> UnloadPackage(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

UniTask<bool> — whether unloading succeeded; treated as handled (true) when the package is not found.

Description

Unloads (destroys) the package from memory and unregisters it. The cache files in the local sandbox are not deleted.


UnloadPackageAndClearCacheFiles

public static async UniTask<bool> UnloadPackageAndClearCacheFiles(string packageName, bool destroyPackage = false)

Parameters

ParameterTypeDescription
packageNamestringPackage name.
destroyPackageboolWhether to also clear the manifest files and destroy/remove the package from memory.
Default: false

Returns

UniTask<bool> — whether clearing (and unloading) succeeded; treated as handled (true) when the package is not found.

Description

Clears the package's bundle cache files from the local sandbox; with destroyPackage = true the manifest files are cleared as well and the package is destroyed from memory.

Important This deletes the downloaded asset files locally — typically used to remove a DLC that is no longer needed. To use it again, the package must be re-initialized and re-downloaded.

Example

// Remove a DLC completely (clear files + destroy from memory)
bool succeed = await AssetPatcher.UnloadPackageAndClearCacheFiles("Dlc01Package", true);

Downloader

Creates YooAsset downloaders (ResourceDownloaderOperation) with filtering by Tags, AssetNames, or AssetInfos, and supports combining multiple packages into one download with unified progress (ideal for updating "DLC + main assets" in a single progress bar).

The download progress delegate (DownloadSpeedCalculator.OnDownloadSpeedProgress):

public delegate void OnDownloadSpeedProgress(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes, long downloadSpeedBytes)
ParameterTypeDescription
totalDownloadCountintTotal number of files to download.
currentDownloadCountintNumber of files downloaded so far.
totalDownloadByteslongTotal number of bytes to download.
currentDownloadByteslongNumber of bytes downloaded so far.
downloadSpeedByteslongCurrent download speed (bytes/second).

Reminder Passing -1 for maxConcurrencyDownloadCount (concurrent downloads) or failedRetryCount (retries on failure) uses the global PatchLauncher settings (defaults: 10 concurrent, 3 retries).

Method Overview

Single-Package Downloaders

MethodDescription
GetPackageDownloaderCreates a downloader for all content.
GetPackageDownloaderByTagsCreates a downloader filtered by tags.
GetPackageDownloaderByAssetNamesCreates a downloader filtered by asset names.
GetPackageDownloaderByAssetInfosCreates a downloader filtered by AssetInfo.

Combined Downloader Getters

MethodDescription
GetDownloadersWithCombinePackagesCreates downloader arrays for multiple packages.
GetDownloadersWithCombinePackagesByTagsCreates downloader arrays for multiple packages by tags.
GetDownloadersWithCombinePackagesByAssetNamesCreates downloader arrays for multiple packages by asset names.
GetDownloadersWithCombinePackagesByAssetInfosCreates downloader arrays for multiple packages by AssetInfo.

Combined Download

MethodDescription
BeginDownloadWithCombinePackagesStarts a combined download of multiple packages.
BeginDownloadWithCombinePackagesByTagsStarts a combined download of multiple packages by tags.
BeginDownloadWithCombinePackagesByAssetNamesStarts a combined download of multiple packages by asset names.
BeginDownloadWithCombinePackagesByAssetInfosStarts a combined download of multiple packages by AssetInfo.
BeginDownloadWithCombineDownloadersStarts a combined download of prepared downloaders.

Download Info

MethodDescription
GetDownloadInfoWithCombinePackagesTotals the pending download count and size of multiple packages.
GetDownloadInfoWithCombinePackagesByTagsTotals the pending downloads filtered by tags.
GetDownloadInfoWithCombinePackagesByAssetNamesTotals the pending downloads filtered by asset names.
GetDownloadInfoWithCombinePackagesByAssetInfosTotals the pending downloads filtered by AssetInfo.

GetPackageDownloader

public static ResourceDownloaderOperation GetPackageDownloader(ResourcePackage package)
public static ResourceDownloaderOperation GetPackageDownloader(ResourcePackage package, int maxConcurrencyDownloadCount, int failedRetryCount)

Parameters

ParameterTypeDescription
packageResourcePackageTarget package.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.

Returns

ResourceDownloaderOperation — a downloader (YooAsset) for all updated content of the package.

Description

Creates a resource downloader for the package. Use the downloader's TotalDownloadCount / TotalDownloadBytes to inspect the pending downloads, and start the download at your own timing.

Example

var package = AssetPatcher.GetPackage("Dlc01Package");
var downloader = AssetPatcher.GetPackageDownloader(package);

Debug.Log($"Files to download: {downloader.TotalDownloadCount}, size: {downloader.TotalDownloadBytes} bytes");

GetPackageDownloaderByTags

public static ResourceDownloaderOperation GetPackageDownloaderByTags(ResourcePackage package, params string[] tags)
public static ResourceDownloaderOperation GetPackageDownloaderByTags(ResourcePackage package, int maxConcurrencyDownloadCount, int failedRetryCount, params string[] tags)

Parameters

ParameterTypeDescription
packageResourcePackageTarget package.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
tagsstring[]Asset group tags (params). When null or empty, all content is downloaded.

Returns

ResourceDownloaderOperation — a downloader filtered by tags.

Description

Creates a downloader restricted to the given tags — useful for downloading in batches (by group).

Example

var package = AssetPatcher.GetDefaultPackage();
var downloader = AssetPatcher.GetPackageDownloaderByTags(package, "UI", "Battle");

GetPackageDownloaderByAssetNames

public static ResourceDownloaderOperation GetPackageDownloaderByAssetNames(ResourcePackage package, params string[] assetNames)
public static ResourceDownloaderOperation GetPackageDownloaderByAssetNames(ResourcePackage package, int maxConcurrencyDownloadCount, int failedRetryCount, params string[] assetNames)

Parameters

ParameterTypeDescription
packageResourcePackageTarget package.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
assetNamesstring[]Asset name list (params). When null or empty, all content is downloaded.

Returns

ResourceDownloaderOperation — a downloader filtered by asset names.

Description

Creates a downloader restricted to the bundles that contain the given asset names, allowing precise updates of specific assets.


GetPackageDownloaderByAssetInfos

public static ResourceDownloaderOperation GetPackageDownloaderByAssetInfos(ResourcePackage package, params AssetInfo[] assetInfos)
public static ResourceDownloaderOperation GetPackageDownloaderByAssetInfos(ResourcePackage package, int maxConcurrencyDownloadCount, int failedRetryCount, params AssetInfo[] assetInfos)

Parameters

ParameterTypeDescription
packageResourcePackageTarget package.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
assetInfosAssetInfo[]YooAsset AssetInfo list (params). When null or empty, all content is downloaded.

Returns

ResourceDownloaderOperation — a downloader filtered by AssetInfo.

Description

Creates a downloader restricted to the bundles that contain the given AssetInfo entries.


GetDownloadersWithCombinePackages

public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackages(ResourcePackage[] packages)
public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackages(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.

Returns

ResourceDownloaderOperation[] — an array with one downloader per package.

Description

Creates one downloader per package, usable with BeginDownloadWithCombineDownloaders for a combined download.


GetDownloadersWithCombinePackagesByTags

public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackagesByTags(ResourcePackage[] packages, params string[] tags)
public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackagesByTags(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, params string[] tags)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
tagsstring[]Asset group tags (params). When null or empty, all content is downloaded.

Returns

ResourceDownloaderOperation[] — downloader array filtered by tags.

Description

Creates one downloader per package filtered by tags.


GetDownloadersWithCombinePackagesByAssetNames

public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackagesByAssetNames(ResourcePackage[] packages, params string[] assetNames)
public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackagesByAssetNames(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, params string[] assetNames)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
assetNamesstring[]Asset name list (params). When null or empty, all content is downloaded.

Returns

ResourceDownloaderOperation[] — downloader array filtered by asset names.

Description

Creates one downloader per package filtered by asset names.


GetDownloadersWithCombinePackagesByAssetInfos

public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackagesByAssetInfos(ResourcePackage[] packages, params AssetInfo[] assetInfos)
public static ResourceDownloaderOperation[] GetDownloadersWithCombinePackagesByAssetInfos(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, params AssetInfo[] assetInfos)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
assetInfosAssetInfo[]YooAsset AssetInfo list (params). When null or empty, all content is downloaded.

Returns

ResourceDownloaderOperation[] — downloader array filtered by AssetInfo.

Description

Creates one downloader per package filtered by AssetInfo.


BeginDownloadWithCombinePackages

public static async UniTask<bool> BeginDownloadWithCombinePackages(ResourcePackage[] packages, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)
public static async UniTask<bool> BeginDownloadWithCombinePackages(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
onDownloadSpeedProgressOnDownloadSpeedProgressCombined progress callback (includes download speed).
Default: null
onDownloadErrorDownloaderOperation.DownloadErrorDownload failure callback (YooAsset).
Default: null

Returns

UniTask<bool> — whether all downloads succeeded; false if any downloader fails, true when there is nothing to download.

Description

Downloads the updated content of multiple packages sequentially, reporting progress against the combined totals (a single progress bar). Ideal for updating "DLC + main assets" in one pass.

Example

var packages = AssetPatcher.GetPresetAppPackages();

bool succeed = await AssetPatcher.BeginDownloadWithCombinePackages(
packages,
onDownloadSpeedProgress: (totalCount, currentCount, totalBytes, currentBytes, speedBytes) =>
{
// Update the download progress UI (with download speed)
Debug.Log($"Progress: {currentCount}/{totalCount}, speed: {speedBytes} bytes/s");
},
onDownloadError: (errorData) =>
{
// Handle the download failure
});

BeginDownloadWithCombinePackagesByTags

public static async UniTask<bool> BeginDownloadWithCombinePackagesByTags(ResourcePackage[] packages, string[] tags = null, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)
public static async UniTask<bool> BeginDownloadWithCombinePackagesByTags(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, string[] tags = null, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
tagsstring[]Asset group tags. When null, all content is downloaded.
Default: null
onDownloadSpeedProgressOnDownloadSpeedProgressCombined progress callback.
Default: null
onDownloadErrorDownloaderOperation.DownloadErrorDownload failure callback.
Default: null

Returns

UniTask<bool> — whether all downloads succeeded.

Description

Starts a combined download of multiple packages filtered by tags. Otherwise behaves like BeginDownloadWithCombinePackages.


BeginDownloadWithCombinePackagesByAssetNames

public static async UniTask<bool> BeginDownloadWithCombinePackagesByAssetNames(ResourcePackage[] packages, string[] assetNames = null, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)
public static async UniTask<bool> BeginDownloadWithCombinePackagesByAssetNames(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, string[] assetNames = null, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
assetNamesstring[]Asset name list. When null, all content is downloaded.
Default: null
onDownloadSpeedProgressOnDownloadSpeedProgressCombined progress callback.
Default: null
onDownloadErrorDownloaderOperation.DownloadErrorDownload failure callback.
Default: null

Returns

UniTask<bool> — whether all downloads succeeded.

Description

Starts a combined download of multiple packages filtered by asset names. Otherwise behaves like BeginDownloadWithCombinePackages.


BeginDownloadWithCombinePackagesByAssetInfos

public static async UniTask<bool> BeginDownloadWithCombinePackagesByAssetInfos(ResourcePackage[] packages, AssetInfo[] assetInfos = null, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)
public static async UniTask<bool> BeginDownloadWithCombinePackagesByAssetInfos(ResourcePackage[] packages, int maxConcurrencyDownloadCount, int failedRetryCount, AssetInfo[] assetInfos = null, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
maxConcurrencyDownloadCountintConcurrent download count. -1 uses the global settings.
failedRetryCountintRetry count on download failure. -1 uses the global settings.
assetInfosAssetInfo[]YooAsset AssetInfo list. When null, all content is downloaded.
Default: null
onDownloadSpeedProgressOnDownloadSpeedProgressCombined progress callback.
Default: null
onDownloadErrorDownloaderOperation.DownloadErrorDownload failure callback.
Default: null

Returns

UniTask<bool> — whether all downloads succeeded.

Description

Starts a combined download of multiple packages filtered by AssetInfo. Otherwise behaves like BeginDownloadWithCombinePackages.


BeginDownloadWithCombineDownloaders

public static async UniTask<bool> BeginDownloadWithCombineDownloaders(ResourceDownloaderOperation[] downloaders, OnDownloadSpeedProgress onDownloadSpeedProgress = null, DownloadError onDownloadError = null)

Parameters

ParameterTypeDescription
downloadersResourceDownloaderOperation[]Prepared downloader array (different creation methods can be mixed).
onDownloadSpeedProgressOnDownloadSpeedProgressCombined progress callback.
Default: null
onDownloadErrorDownloaderOperation.DownloadErrorDownload failure callback.
Default: null

Returns

UniTask<bool> — whether all downloads succeeded; false if any downloader fails, true when there is nothing to download.

Description

Downloads multiple prepared downloaders sequentially with unified progress totals. This is the underlying implementation of the BeginDownloadWithCombinePackages family — handy when combining downloaders built with different filters into one download pass.


GetDownloadInfoWithCombinePackages

public static DownloadInfo GetDownloadInfoWithCombinePackages(ResourcePackage[] packages)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.

Returns

DownloadInfo — the combined pending download count and bytes (see the DownloadInfo struct).

Description

Totals the pending downloads of multiple packages — useful for showing a "download N files (M bytes)?" confirmation before starting.

Example

var packages = AssetPatcher.GetPresetAppPackages();
var info = AssetPatcher.GetDownloadInfoWithCombinePackages(packages);

Debug.Log($"Files to download: {info.totalCount}, total size: {info.totalBytes} bytes");

GetDownloadInfoWithCombinePackagesByTags

public static DownloadInfo GetDownloadInfoWithCombinePackagesByTags(ResourcePackage[] packages, params string[] tags)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
tagsstring[]Asset group tags (params). When null or empty, all content is counted.

Returns

DownloadInfo — the combined pending download count and bytes.

Description

Totals the pending downloads of multiple packages filtered by tags.


GetDownloadInfoWithCombinePackagesByAssetNames

public static DownloadInfo GetDownloadInfoWithCombinePackagesByAssetNames(ResourcePackage[] packages, params string[] assetNames)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
assetNamesstring[]Asset name list (params). When null or empty, all content is counted.

Returns

DownloadInfo — the combined pending download count and bytes.

Description

Totals the pending downloads of multiple packages filtered by asset names.


GetDownloadInfoWithCombinePackagesByAssetInfos

public static DownloadInfo GetDownloadInfoWithCombinePackagesByAssetInfos(ResourcePackage[] packages, params AssetInfo[] assetInfos)

Parameters

ParameterTypeDescription
packagesResourcePackage[]Target packages.
assetInfosAssetInfo[]YooAsset AssetInfo list (params). When null or empty, all content is counted.

Returns

DownloadInfo — the combined pending download count and bytes.

Description

Totals the pending downloads of multiple packages filtered by AssetInfo.


Paths & Utilities

Helpers for local/built-in asset paths, the store link, group records, and decryption services.

Method Overview

Path Queries

MethodDescription
GetLocalSandboxRootPathGets the local persistent storage root directory.
GetLocalSandboxPackagePathGets a package's local persistent path.
GetBuiltinRootPathGets the built-in asset root directory.
GetBuiltinPackagePathGets a package's built-in asset path.
GetRequestStreamingAssetsPathGets a StreamingAssets path suitable for UnityWebRequest.

Store & Misc

MethodDescription
GetAppStoreLinkGets the app store link.
GoToAppStoreOpens the system browser at the store page.
GetDefaultGroupTagGets the default group tag (#all).
ClearLastGroupInfoClears the last selected group record.
GetBundleDecryptionServicesGets the bundle decryption services.
GetManifestDecryptionServicesGets the manifest decryption services.

GetLocalSandboxRootPath

public static string GetLocalSandboxRootPath()

Returns

string — the local persistent storage root directory (YooAsset default cache root, .../yoo).

Description

Gets the local storage (sandbox) root directory for downloaded assets.


GetLocalSandboxPackagePath

public static string GetLocalSandboxPackagePath(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

string — the package's local persistent path (.../yoo/<PackageName>).

Description

Gets the local storage path of the package's downloaded assets.


GetBuiltinRootPath

public static string GetBuiltinRootPath()

Returns

string — the built-in asset root directory (.../StreamingAssets/yoo).

Description

Gets the root directory of the assets shipped with the build.


GetBuiltinPackagePath

public static string GetBuiltinPackagePath(string packageName)

Parameters

ParameterTypeDescription
packageNamestringPackage name.

Returns

string — the package's built-in asset path (.../StreamingAssets/yoo/<PackageName>).

Description

Gets the built-in asset path of the package shipped with the build.


GetRequestStreamingAssetsPath

public static string GetRequestStreamingAssetsPath()

Returns

string — a StreamingAssets path suitable for UnityWebRequest (the file:// prefix is added automatically on macOS/iOS).

Description

Gets a cross-platform StreamingAssets path usable for web requests.


public static async UniTask<string> GetAppStoreLink()

Returns

UniTask<string> — the store link (STORE_LINK) from the config file.

Description

Reads the app store link from the bundle URL config file (burlcfg), used to guide players to update when the app version is outdated.


GoToAppStore

public static void GoToAppStore()

Description

Reads the store link and opens the system browser at the store page via Application.OpenURL (to update the app itself).


GetDefaultGroupTag

public static string GetDefaultGroupTag()

Returns

string — the default group tag (#all).

Description

Gets the default tag of the patch groups (grouped packaging), representing all content.


ClearLastGroupInfo

public static void ClearLastGroupInfo()

Description

Clears the locally stored "last selected group (GroupInfo)" record. The patch flow remembers which asset group the player chose to download last time; this method resets that record.


GetBundleDecryptionServices

public static DecryptionServices GetBundleDecryptionServices()

Returns

DecryptionServices — the configured bundle decryption services; null when no encryption (NONE) is configured.

Description

Gets the bundle decryption services (YooAsset) initialized from the PatchLauncher cryptogram settings.


GetManifestDecryptionServices

public static DecryptionServices GetManifestDecryptionServices()

Returns

DecryptionServices — the configured manifest decryption services; null when no encryption (NONE) is configured.

Description

Gets the manifest decryption services (YooAsset) initialized from the PatchLauncher cryptogram settings.


Release

Release

public async static UniTask Release()

Returns

UniTask — an awaitable async operation.

Description

Releases the entire asset system: destroys and removes all packages, destroys YooAssets, and clears the bundle-related global configuration to ensure memory is reclaimed correctly.

Important Call this when the game is about to quit. Afterwards IsReleased returns true, bundle-unloading operations in AssetLoaders are skipped, and the asset system can no longer be used.

Example

private async void OnApplicationQuit()
{
await AssetPatcher.Release();
}