-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Starfire edited this page Dec 28, 2023
·
13 revisions
- 【YooAsset】 (1.5.7)
- 【安装】 Unity Menu -> AIO -> CLI -> Install -> YooAsset
- 【卸载】 Unity Menu -> AIO -> CLI -> UnInstall -> YooAsset
创建配置文件 搭配 API AssetSystem.Initialize(ASConfig.GetOrCreate());
Create Config API | Description | Mode |
---|---|---|
ASConfig.GetOrCreate |
获取已存在配置文件夹 或创建编辑器配置文件 | 配置自选模式 |
ASConfig.GetLocal |
获取已存在配置文件夹 或 创建本地配置文件 | 本地模式 |
ASConfig.GetRemote |
获取已存在配置文件夹 或 创建远端配置文件 | 远端模式 |
ASConfig.GetEditor |
获取已存在配置文件夹 或 创建编辑器配置文件 | 编辑器模式 |
public async Task RemoteInitialize()
{
await AssetSystem.Initialize(ASConfig.GetRemote("https://xxx.com/xxx"));
var AssetEvent = new DownlandAssetEvent
{
OnProgress = Debug.Log, // 进度回调
OnError = Debug.LogException, // 错误回调
OnComplete = () => { } // 完成回调
};
// Tips : 以下 API 均为可选 API 但是必须选择其中一个 API 执行 否则无法使用远端模式
// 下载指定标签资源包 并且下载序列记录文件
await AssetSystem.DownloadTagWithRecord("Config", AssetEvent);
// or 下载全部资源包
await AssetSystem.DownloadAll(AssetEvent);
// or 下载全部资源包基础信息 (版本号, 清单文件) 不下载实际资源包
await AssetSystem.DownloadHeader(AssetEvent);
// or 下载全部序列记录文件列表
await AssetSystem.DownloadRecord(AssetEvent);
// or 使用自定义下载器
using (var handle = AssetSystem.GetDownloader(AssetEvent))
{
await handle.UpdateHeader();
handle.Begin();
// 下载根据需求调用API 也可以不执行下面函数 只更新资源包版本和清单文件
handle.CollectNeedTag("Config"); // 下载指定标签资源包
handle.CollectNeedRecord(); // 下载序列记录文件
handle.CollectNeedAll(); // 下载全部资源包
await handle.WaitCo();
// 操作 API 如果需要暂停等操作可执行以下API
handle.Cancel(); // 取消下载
handle.Pause(); // 暂停下载
handle.Resume(); // 恢复下载
}
}
Load Sync API | Description |
---|---|
AssetSystem.LoadAsset("location") |
加载资源 |
AssetSystem.LoadSubAssets("location") |
加载子资源 |
AssetSystem.InstGameObject("location") |
实例化 GameObject |
AssetSystem.LoadRawFileText("location") |
加载原生文件文本 |
AssetSystem.LoadRawFileData("location") |
加载原生文件数据 |
AssetSystem.LoadScene("location", (r)=>{}) |
加载场景 实际为异步回调加载 |
Load Async API | Description |
---|---|
await AssetSystem.LoadAssetTask("location") |
加载资源 |
await AssetSystem.LoadSubAssetsTask("location") |
加载子资源 |
await AssetSystem.InstGameObjectTask("location") |
实例化 GameObject |
await AssetSystem.LoadRawFileTextTask("location") |
加载原生文件文本 |
await AssetSystem.LoadRawFileDataTask("location") |
加载原生文件数据 |
await AssetSystem.LoadSceneTask("location") |
加载场景 实际为异步回调加载 |
Load Coroutine API | Description |
---|---|
yield return AssetSystem.LoadAssetCO("location", (r)=>{}) |
加载资源 |
yield return AssetSystem.LoadSubAssetsCO("location", (r)=>{}) |
加载子资源 |
yield return AssetSystem.InstGameObjectCO("location", (r)=>{}) |
实例化 GameObject |
yield return AssetSystem.LoadRawFileTextCO("location", (r)=>{}) |
加载原生文件文本 |
yield return AssetSystem.LoadRawFileDataCO("location", (r)=>{}) |
加载原生文件数据 |
yield return AssetSystem.LoadSceneCO("location", (r)=>{}) |
加载场景 实际为异步回调加载 |
Net Load Async Callback API (Need Support UniTask) | Description |
---|---|
AssetSystem.NetLoadBytes("location", (r)=>{}) |
加载资源 |
AssetSystem.NetLoadAssetBundle("location", (r)=>{}) |
加载 AB 包 |
AssetSystem.NetLoadSprite("location", (r)=>{}) |
加载 Sprite |
AssetSystem.NetLoadTexture("location", (r)=>{}) |
加载 Texture |
AssetSystem.NetLoadAudioClip("location", (r)=>{}) |
加载 AudioClip |
Net Load Async API (Need Support UniTask) | Description |
---|---|
await AssetSystem.NetLoadBytesTask("location") |
加载资源 |
await AssetSystem.NetLoadAssetBundleTask("location") |
加载 AB 包 |
await AssetSystem.NetLoadSpriteTask("location") |
加载 Sprite |
await AssetSystem.NetLoadTextureTask("location") |
加载 Texture |
await AssetSystem.NetLoadAudioClipTask("location") |
加载 AudioClip |
Net Load Coroutine API | Description |
---|---|
yield return AssetSystem.NetLoadBytesCO("location", (r)=>{}) |
加载资源 |
yield return AssetSystem.NetLoadAssetBundleCO("location", (r)=>{}) |
加载 AB 包 |
yield return AssetSystem.NetLoadSpriteCO("location", (r)=>{}) |
加载 Sprite |
yield return AssetSystem.NetLoadTextureCO("location", (r)=>{}) |
加载 Texture |
yield return AssetSystem.NetLoadAudioClipCO("location", (r)=>{}) |
加载 AudioClip |
Thank you for choosing our package. If this package helps you, please consider showing your support by adding a ⭐ to the repo.
This is a command line interface (CLI) package for Unity. It provides a set of commands and tools to enhance the efficiency of Unity development.
- Unity 2019.1 or later
- .NET 6.0 or later
Please refer to the wiki for a step-by-step guide on how to get started with this package.