Skip to content

Commit 055b8d0

Browse files
authored
Merge pull request #245 from liuxinyumocn/docs/InstantGame
docs: Update docs
2 parents 2e71c9d + 74b05b0 commit 055b8d0

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

Design/CompressedTexture.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ node compress_all.js
108108

109109

110110

111+
## 原理解释
112+
113+
​ 微信纹理压缩工具底层原理是将bundle内纹理资源分离,将资源指针替换至原bundle内,分离出的资源将被处理成多种不同GPU所支持的纹理格式托管至CDN中,游戏实际运行时将劫持渲染时根据资源指针以及当前设备GPU所支持的纹理格式进行远程加载,成功加载立即上传GPU后将从系统内存释放。这样的工作原理即做到了不同硬件所支持的纹理格式按需加载,又相比于bundle全部加载至内存时占用过多的系统内存。经过微信小游戏团队测试,该工具能够降低游戏的运行时内存情况,不同的游戏之间使用的场景、纹理差异降低值是不相同的。
114+
115+
116+
111117
## Q&A
112118

113119
### 1.生成的纹理太大

Design/InstantGameGuide.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@
2222

2323
Windows平台:
2424

25-
- Unity Editor:[Editor_2021.2.5f1c301_a10](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a10/UnitySetup64.exe)
26-
- 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)
25+
- Unity Editor:[Editor_2021.2.5f1c301_a9](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/UnitySetup64.exe)
26+
- 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)
2727

2828
MacOS平台:
2929

3030
- Unity Editor:[Editor_2021.2.5f1c301_a9](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/Unity.pkg)
3131
- 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)
3232

33-
3433
InstantGame Package:
3534

36-
[com.unity.instantgame.zip](https://unity-1258948065.cos.ap-shanghai.myqcloud.com/test/AutoStreamerTest1/Release/Alpha/c301_a9/com.unity.instantgame.zip)
35+
前往 Unity 菜单 `Window - Package Manager` 安装 `Project Instant Game` 0.1.9 版本
36+
37+
3738

3839
### MacOS 安装
3940

@@ -78,7 +79,7 @@ public void SelectChild(LevelSelectButton levelSelectButton)
7879

7980
#### 3.导入 Instant Game 工具包
8081

81-
​ 在 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** 文件
82+
​ 在 Unity Editor 菜单栏 `Windows - Package Manager ` 面板安装 `Project Instant Game` 0.1.9 版本
8283

8384
#### 4.启用 Auto Streaming 能力
8485

@@ -311,6 +312,23 @@ public class XXX : MonoBehaviour
311312

312313

313314

315+
### Addressable指引
316+
317+
​ Addressable本质也是bundle的加载,因此对于使用低高清资源自动加载的方案时,仍需要对转换后进行资源重构bundle,本小结重点介绍Addressable的远程配置说明。
318+
319+
​ 相比于AB包,AA包是由Unity底层完成的加载,因此通常只需关注远程路径配置,在 [**Assets Bundle指引**](#AssetsBundle指引)章节中已说明 `CustomCloudAssets` 目录将作为开发者自行管理的CDN资源目录,因此需要将由 Addressable 构建的 bundle 资源放置该目录内,在 `Addressable - Profiles` 面板中的远程地址配置应该如下近似形式:
320+
321+
```
322+
RemoteLoadPath:
323+
https://assetstreaming-wg-content.unity.cn/client_api/v1/buckets/XXXXXX/release_by_badge/0_0_3/content/CUS/GameRes
324+
```
325+
326+
​ 其中,`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 资源。
327+
328+
**注意:**CCD服务本质采用腾讯云COS(CDN),不支持对资源后缀使用 `?rand=xxx` 方式避免缓存,实际项目中也将因为Bucket、Badge等路径前缀隔绝不同版本资源的情况,因此在CDN资源的存储中原则上也无需避免缓存。
329+
330+
331+
314332
### Scene 加载体验问题
315333

316334
​ 在实践中将发现使用 Instant Game 转化的游戏首次切换场景期间等待时间较长,且没有任何的界面上给用户的加载进度回应,这对于用户的体验是不友好的。由于 Unity 引擎对底层的原本地 Load Scene(同步)方法进行了替换,所以原底层方法是不具备提供进度回调的能力,因此在实际的游戏优化的过程中,应对被加载的场景进行基于 AA/AB 的手动分包,并在可能的较大资源的加载位置增加游戏UI上的给用户的进度回应。
@@ -333,3 +351,9 @@ public class XXX : MonoBehaviour
333351
- https://docs.qq.com/doc/DQmlUakFQb3FFY2Fu
334352

335353
354+
355+
## Q&A
356+
357+
#### 1.游戏在微信开发者工具中运行缺失资源?
358+
359+
​ 经过 AutoStreaming 转换后开发者应在微信开发者工具检查控制台中Network面板资源是否加载正常,若存在404时,需要查看资源是否正确上传、读取路径是否正确等。

0 commit comments

Comments
 (0)