Skip to main content
Version: v3

Module Introduction

Important Attention Reminder

Coding Style wiki


Basic Description

Resource loader module that supports dynamic Async or Sync loading (Dynamic Loading), using a reference counting management approach for resource control (supports Resources and AssetBundle). If you directly use AssetLoaders API for Load and Instantiate, you need to call Unload when destroying objects (paired calls: Load & Unload).

Integrated with YooAsset to implement resource hot-update solution, with additional implementation of encryption interfaces provided by YooAsset. The file encryption/decryption methods implemented include:

  • Offset (Offset method)
  • OffsetXOR (Offset + XOR)
  • XOR
  • HT2XOR (Head-Tail 2 XOR)
  • HT2XORPlus (Head-Tail 2 XOR Plus) Enhanced version
  • ChaCha20
  • XXTEA
  • AES

For reference only (Efficiency Reference)

  • Computational efficiency: Offset > HT2XOR > XOR >= OffsetXOR >= HT2XORPlus > XXTEA > ChaCha20 > AES
  • Memory usage: Offset ≈ OffsetXOR > AES ≈ ChaCha20 > XXTEA > HT2XORPlus = HT2XOR = XOR
  • AB package size increase: Offset ≈ OffsetXOR > AES ≈ ChaCha20 > XXTEA > HT2XORPlus = HT2XOR = XOR
  • Cracking difficulty: AES ≈ ChaCha20 > XXTEA > HT2XORPlus > HT2XOR > OffsetXOR > XOR > Offset

Group package examples

  • Minimum runtime package
  • Standard runtime package
  • Full runtime package (default index tag is #all)

Important If you want to use synchronous loading, resources must be pre-downloaded (mainly because when resources are not local, the download request part is handled asynchronously). Also note that synchronous loading is only suitable for small resources (strongly recommend using asynchronous processing for everything).

Attention Using the res# prefix will switch to Resources loading mode. Otherwise, AssetBundle will be used.

Reminder When using YooAsset, if you have questions, please refer to the official documentation for familiarization.


Process Description

Check if PlayMode Initialization is Complete

Poll AssetPatcher.IsInitialized() to check if Preset Packages initialization is complete, because only after initialization is complete can you start loading Built-in Bundles and perform AssetPatcher.Check() update checks, or download while playing.

Reminder Distinguish between Built-in and Patch (define the operation flow according to your situation).

Reminder After executing AssetPatcher.Check() to check for Patch updates, you can read the updated resources.

  • When executing the AssetPatcher.Check() check process, Preset App Packages and Preset DLC Packages will be merged and downloaded together.
Preset App Packages & Preset DLC Packages
Preset_App_Pkg_01 (TotalCount = 3, TotalSize = 600 KB)
Preset_App_Pkg_02 (TotalCount = 6, TotalSize = 1200 KB)
Preset_DLC_Pkg_01 (TotalCount = 2, TotalSize = 200 KB)
Preset_DLC_Pkg_02 (TotalCount = 4, TotalSize = 400 KB)
Combination
Preset_App_Pkg_01 + Preset_App_Pkg_02 + Preset_DLC_Pkg_01 + Preset_DLC_Pkg_02 (TotalCount = 15, TotalSize = 2400 KB)

Important DLC Packages set through Preset must be fixed version numbers (e.g., "latest").

Whether to Enable Disk Space Check Process

Check if Update is Complete

  • Check AssetPatcher.IsDone() to determine if the update is complete.

Summary of Execution Order Process

  • Poll initial state AssetPatcher.IsInitialized() -> Execute update check AssetPatcher.Check() -> Poll completion state AssetPatcher.IsDone() -> Update complete.