nomadro/apps/minigame-unity/docs/WECHAT_EXPORT.md
Eric 58a845db32 Add WeChat minigame triple-engine scaffold with Godot Chiang Mai plaza SoT.
Unity and Cocos stay as parallel schemes; apps/minigame ships the Godot 4.7 WeChat pack for DevTools.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-06 20:17:14 +08:00

58 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Unity → 微信小游戏导出
官方文档:https://developers.weixin.qq.com/minigame/dev/guide/game-engine/unity-webgl-transform/
## 前置
1. Unity **2022.3.1–2022.3.14** + **WebGL** 模块
2. 微信开发者工具 **稳定版 Stable**(不要用 Minigame Build 专用版)
3. 小游戏 AppID:`wx2900cac0858ca7dc`
4. MP 后台开通:**能力地图 → 生产提效包 → 快适配**
## 安装微信转换 SDK
工程 `Packages/manifest.json` 已写入(Gitee):
```
com.qq.weixin.minigame → https://gitee.com/wechat-minigame/minigame-tuanjie-transform-sdk.git
```
打开工程时 Unity 会自动拉包。也可手动:Package Manager → `+` → Add package from git URL(GitHub 同仓库亦可)。
会在 `Assets/WX-WASM-SDK-V2` 生成配置数据,请纳入版本库。
## 转换
菜单:**微信小游戏 → 转换小游戏**
| 项 | 值 |
|---|---|
| 游戏 appid | `wx2900cac0858ca7dc` |
| 游戏资源 CDN | 首包资源 HTTP/CDN(本地调试可用临时静态服 + 开发者工具不校验域名) |
| 导出路径 | 如 `apps/minigame-unity/Build/wechat` |
| 方向 | portrait |
| 首包资源 | 开发期可「小游戏包内」(总包注意 20MB 上限) |
完成后目录:
```
Build/wechat/
minigame/ ← 用微信开发者工具导入这个
webgl/
```
## 预览
1. 开发者工具导入 `minigame/`
2. 预览 / 扫码
3. **禁止使用「真机调试」**
## 密钥(服务端登录等)
```
WX_MINIGAME_APPID=wx2900cac0858ca7dc
WX_MINIGAME_APPSECRET=30b75c703efc7ee81ae25f8daf1636eb
```
`code2Session` 走服务端;玩法本体可单机。