From 74b05b06fa0cc6e99c438d632b9652806600913f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=95=E7=A6=B9?= Date: Mon, 28 Nov 2022 15:22:28 +0800 Subject: [PATCH] docs: Update docs --- Design/CompressedTexture.md | 6 ++++++ Design/InstantGameGuide.md | 34 +++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Design/CompressedTexture.md b/Design/CompressedTexture.md index 1b90372..126ab31 100644 --- a/Design/CompressedTexture.md +++ b/Design/CompressedTexture.md @@ -108,6 +108,12 @@ node compress_all.js +## 原理解释 + +​ 微信纹理压缩工具底层原理是将bundle内纹理资源分离,将资源指针替换至原bundle内,分离出的资源将被处理成多种不同GPU所支持的纹理格式托管至CDN中,游戏实际运行时将劫持渲染时根据资源指针以及当前设备GPU所支持的纹理格式进行远程加载,成功加载立即上传GPU后将从系统内存释放。这样的工作原理即做到了不同硬件所支持的纹理格式按需加载,又相比于bundle全部加载至内存时占用过多的系统内存。经过微信小游戏团队测试,该工具能够降低游戏的运行时内存情况,不同的游戏之间使用的场景、纹理差异降低值是不相同的。 + + + ## Q&A ### 1.生成的纹理太大 diff --git a/Design/InstantGameGuide.md b/Design/InstantGameGuide.md index 4d27747..5af544f 100644 --- a/Design/InstantGameGuide.md +++ b/Design/InstantGameGuide.md @@ -22,18 +22,19 @@ Windows平台: -- Unity Editor:[Editor_2021.2.5f1c301_a10](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a10/UnitySetup64.exe) -- WebGL Build Support: [UnitySetup-WebGL-Support-for-Editor-2021.2.5f1c301.exe](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a10/UnitySetup-WebGL-Support-for-Editor-2021.2.5f1c301.exe) +- Unity Editor:[Editor_2021.2.5f1c301_a9](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/UnitySetup64.exe) +- WebGL Build Support: [UnitySetup-WebGL-Support-for-Editor-2021.2.5f1c301.exe](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/UnitySetup-WebGL-Support-for-Editor-2021.2.5f1c301.exe) MacOS平台: - Unity Editor:[Editor_2021.2.5f1c301_a9](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/Unity.pkg) - WebGL Build Support: [UnitySetup-WebGL-Support-for-Editor-2021.2.5f1c301.pkg](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/UnitySetup-WebGL-Support-for-Editor-2021.2.5f1c301.pkg) - InstantGame Package: -[com.unity.instantgame.zip](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/com.unity.instantgame.zip) +前往 Unity 菜单 `Window - Package Manager` 安装 `Project Instant Game` 0.1.9 版本 + + ### MacOS 安装 @@ -78,7 +79,7 @@ public void SelectChild(LevelSelectButton levelSelectButton) #### 3.导入 Instant Game 工具包 -​ 在 Unity Editor 菜单栏 `Windows - Package Manager ` 面板右上角 + 号选择 `Add package from disk` ,窗口中选择下载的 [com.unity.instantgame.zip](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/com.unity.instantgame.zip) 解压文件内 **package.json** 文件。 +​ 在 Unity Editor 菜单栏 `Windows - Package Manager ` 面板安装 `Project Instant Game` 0.1.9 版本。 #### 4.启用 Auto Streaming 能力 @@ -311,6 +312,23 @@ public class XXX : MonoBehaviour +### Addressable指引 + +​ Addressable本质也是bundle的加载,因此对于使用低高清资源自动加载的方案时,仍需要对转换后进行资源重构bundle,本小结重点介绍Addressable的远程配置说明。 + +​ 相比于AB包,AA包是由Unity底层完成的加载,因此通常只需关注远程路径配置,在 [**Assets Bundle指引**](#AssetsBundle指引)章节中已说明 `CustomCloudAssets` 目录将作为开发者自行管理的CDN资源目录,因此需要将由 Addressable 构建的 bundle 资源放置该目录内,在 `Addressable - Profiles` 面板中的远程地址配置应该如下近似形式: + +``` +RemoteLoadPath: +https://assetstreaming-wg-content.unity.cn/client_api/v1/buckets/XXXXXX/release_by_badge/0_0_3/content/CUS/GameRes +``` + +​ 其中,`https://assetstreaming-wg-content.unity.cn/client_api/v1/buckets/XXXXXX/release_by_badge/0_0_3/content` 是游戏AutoStreamingPath,在 `AutoStreaming - Cfg&Publish` 面板可自行复制,`CUS` 是 [7.导入微信Unity - SDK](#7.导入微信Unity - SDK) 章节所介绍的前缀目录地址,`GameRes` 则为游戏 Addressable 构建的 bundle 资源。 + +**注意:**CCD服务本质采用腾讯云COS(CDN),不支持对资源后缀使用 `?rand=xxx` 方式避免缓存,实际项目中也将因为Bucket、Badge等路径前缀隔绝不同版本资源的情况,因此在CDN资源的存储中原则上也无需避免缓存。 + + + ### Scene 加载体验问题 ​ 在实践中将发现使用 Instant Game 转化的游戏首次切换场景期间等待时间较长,且没有任何的界面上给用户的加载进度回应,这对于用户的体验是不友好的。由于 Unity 引擎对底层的原本地 Load Scene(同步)方法进行了替换,所以原底层方法是不具备提供进度回调的能力,因此在实际的游戏优化的过程中,应对被加载的场景进行基于 AA/AB 的手动分包,并在可能的较大资源的加载位置增加游戏UI上的给用户的进度回应。 @@ -333,3 +351,9 @@ public class XXX : MonoBehaviour - https://docs.qq.com/doc/DQmlUakFQb3FFY2Fu ​ + +## Q&A + +#### 1.游戏在微信开发者工具中运行缺失资源? + +​ 经过 AutoStreaming 转换后开发者应在微信开发者工具检查控制台中Network面板资源是否加载正常,若存在404时,需要查看资源是否正确上传、读取路径是否正确等。 -- GitLab