YooAsset Documentation
repository·yoo3·Indexed 24 days ago
https://github.com/tuyoogame/yooassetA professional-grade resource management system for Unity3D (version 3.0.5) designed for large-scale game assets, multi-platform distribution, and complex deployment scenarios such as zero-resource installs. It includes specialized support for WebGL mini-game platforms including Alipay, Kuaishou, OPPO, TapTap, and vivo.
What's inside YooAsset
- YooAsset is a resource management system for Unity3D designed to help development teams rapidly deploy and deliver games. It is built to meet the diverse requirements of commercial games and has been validated by multiple high-traffic game products (millions of DAU).
Overview of YooAsset Resource Management System
yoo3YooAsset is a resource management system for Unity3D designed to help development teams deploy and deliver games efficiently. It is suitable for commercial games and has been validated by products with millions of DAU (Daily Active Users).
Key Use Cases:
- Zero-resource installation packages: Release a small initial package and download assets while playing.
- Tiered content delivery: Provide a guaranteed initial experience, then allow players to download specific levels or content.
- Size-constrained packages: Keep initial downloads under specific limits (e.g., 300MB) by downloading remaining content before game entry.
- Offline/Online hybrid support: Support normal updates when online, while allowing play of older versions when offline.
- MOD support: Enable players to upload MOD content to servers for others to download and play.
- Large-scale project management: Support distributed builds for projects with hundreds of GBs of resources to reduce build times.
Key Features of YooAsset
yoo3YooAsset provides a comprehensive suite of features for asset management:
Build & Packaging
- Seamless Build Pipeline Switching: Supports both traditional built-in pipelines and programmable build pipelines (SBP).
- Distributed Building: Supports building by project or by content, facilitating MOD development.
- Addressable Resource Locating: Supports both full-path and addressable resource locating.
- Secure & Efficient Bundling: Uses a resource tag-based bundling scheme that automatically classifies dependencies to avoid manual maintenance.
- Flexible Packaging System: Allows custom packaging strategies with automatic dependency analysis to ensure zero redundancy and prevent circular dependencies.
Runtime & Loading
- Reference Counting: Uses a reference counting management scheme for safe resource unloading and memory management. Includes an analyzer to detect potential resource leaks.
- Multiple Runtime Modes: Easily switch between Editor Simulation, Single-player (Local), Online, and WebGL modes without code changes.
- Robust Loading System:
- Asynchronous Loading: Supports Coroutines, Tasks, and Delegates.
- Synchronous Loading: Supports mixed use of synchronous and asynchronous loading.
- On-demand Downloading: Automatically downloads missing resource bundles from the server during the loading process.
- Multi-threaded Downloading: Supports breakpoint resumption, automatic file verification, and automatic repair of corrupted files.
- Versatile Downloaders: Create downloaders based on resource tags or specific resource objects. Supports limiting concurrent downloads, setting retry counts, and configuring timeouts. Provides progress tracking and failure callbacks.
Management & Platform Support
- Native File Management: Seamlessly manages and downloads native files alongside the resource system.
- Version Management: Supports quick rollbacks, distinguishing between audit/test/live versions, and gray-scale updates.
- Multi-platform Support: Supports Android, iOS, PC, and WebGL. (Note: 2.x versions specifically support WeChat and Douyin mini-games).
Initialize YooAsset with TaptapFileSystemCreater
yoo3When initializing
WebPlayModeOptionsfor a TapTap Mini Game build, useTaptapFileSystemCreater.CreateFileSystemParametersto configure the file system. This allows the underlying TapTap platform adapter to handle remote AssetBundle requests.Note that even though the platform handles the requests, your business logic should continue to use the standard YooAsset remote asynchronous loading workflow.
#if UNITY_WEBGL && TAPMINIGAME && !UNITY_EDITOR var createParameters = new WebPlayModeOptions(); string defaultHostServer = GetHostServerURL(); string fallbackHostServer = GetHostServerURL(); IRemoteService remoteService = new RemoteService(defaultHostServer, fallbackHostServer); createParameters.WebServerFileSystemParameters = TaptapFileSystemCreater.CreateFileSystemParameters(remoteService); var initializationOperation = package.InitializePackageAsync(createParameters); #endifUse HashName for resource bundle naming on OPPO
yoo3OPPO identifies cacheable resources using the hash within the remote filename. To ensure maximum compatibility with OPPO's caching rules and to avoid exposing original bundle names, YooAsset recommends using the
HashNamenaming convention.Avoid:
BundleNameorBundleName_HashNamefor OPPO cache builds.Example of
HashNameoutput:8d265a9dfd6cb7669cdb8b726f0afb1e.bundleConfigure AssetBundle naming for vivo Mini Game
yoo3The vivo Mini Game platform's underlying cache relies on the hash within the AssetBundle filename.
To ensure maximum compatibility and avoid exposing original bundle names, YooAsset recommends using the
HashNamenaming style. This generates filenames consisting only of a hash, such as8d265a9dfd6cb7669cdb8b726f0afb1e.bundle.Avoid using
BundleNameorBundleName_HashNamefor vivo Mini Game builds.Setup UniTask support (Source Code Method)
yoo3If you are using the UniTask source code directly, follow these steps to enable YooAsset integration:
- Download and import UniTask source code into your project.
- Modify
UniTask/Runtime/_InternalVisibleTo.csto include the YooAsset assembly visibility:[assembly: InternalsVisibleTo("UniTask.YooAsset")] // Add this line - Copy the YooAsset extension scripts from
YooAssets/Samples/UniTask Sample/UniTaskinto your project. - Add the following symbol to your Scripting Define Symbols in
Project Settings > Player > Scripting Define Symbols:YOOASSET_UNITASK_SUPPORT - Restart the Unity engine.
Initialize YooAsset with Alipay File System
yoo3When initializing
WebPlayModeOptionsfor an Alipay Mini Game build, useAlipayFileSystemCreater.CreateFileSystemParametersto generate the file system parameters.Note that the Alipay Mini Game platform handles remote AssetBundle requests at a low level; your business logic should continue to use the standard YooAsset remote asynchronous loading workflow.
#if UNITY_WEBGL && UNITY_ALIMINIGAME && !UNITY_EDITOR var createParameters = new WebPlayModeOptions(); string defaultHostServer = GetHostServerURL(); string fallbackHostServer = GetHostServerURL(); IRemoteService remoteService = new RemoteService(defaultHostServer, fallbackHostServer); createParameters.WebServerFileSystemParameters = AlipayFileSystemCreater.CreateFileSystemParameters(remoteService); var initializationOperation = package.InitializePackageAsync(createParameters); #endifConfigure AssetBundle Naming for TapTap Mini Games
yoo3For TapTap Mini Game builds, it is highly recommended to use the
HashNamenaming convention. This generates pure hash filenames (e.g.,8d265a9dfd6cb7669cdb8b726f0afb1e.bundle), which is better for platform caching, update identification, and security (avoiding exposure of original bundle names).Avoid using
BundleNameorBundleName_HashNamefor TapTap Mini Game builds.Setup UniTask support (Package Method)
yoo3If you are using UniTask via a Unity Package, follow these steps:
- Import the UniTask plugin via Package Manager.
- Copy the YooAsset extension scripts from
YooAssets/Samples/UniTask Sample/UniTaskandYooAssets/Samples/UniTask Sample/UniTaskRefinto your project. - Add the following symbol to your Scripting Define Symbols in
Project Settings > Player > Scripting Define Symbols:YOOASSET_UNITASK_SUPPORT - Restart the Unity engine.
Setup YooAsset for TapTap Mini Games
yoo3To use YooAsset in a TapTap Mini Game WebGL environment, you must first install the TapTap Mini Game Unity/Tuanjie WebGL Adaptation SDK and switch your project build target to WebGL.
Enable the
TAPMINIGAMEscripting define symbol in your WebGL Player settings. This macro is used by YooAsset to maintain consistency with other mini-game platform adaptation code.If you encounter compilation errors stating that
TapTapMiniGame,TapAssetBundle, orDownloadHandlerTapAssetBundlecannot be found, ensure the TapTap SDK is imported and that the TapTap SDK assembly is added to theYooAsset.MiniGame.asmdefassembly reference.Access YooAsset Documentation
yoo3For detailed tutorials, guides, and technical documentation, visit the official YooAsset website.
https://www.yooasset.com/