Files
AIGame/Doc/Rule/UnityUIProject.md
T
udxandCursor b7a0bbcb89 Add hot-update boot pipeline, UI bundles/atlas assets, and design docs.
Ignore AIClient/Library and AIClient/HybridCLRData permanently; include HybridCLR/YooAsset project setup and UI tooling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-21 16:02:58 +08:00

2.3 KiB
Raw Blame History

Unity UI 工程约定(AIGame)

从 AIC# UnityProject.md 抽取 UI 相关条款,并按本仓库竖屏 / Bundles / YooAsset / HybridCLR 改写。

环境

  • Unity:2022.3.62f3(AIClient/ProjectSettings/ProjectVersion.txt)
  • 客户端:AIClient/
  • 屏幕:竖屏;UI 设计分辨率 1080×1920
  • 资源包:YooAsset;业务代码:HybridCLR HotUpdate

目录

用途 路径
通用 UI 贴图 Assets/Bundles/UI/Texture/Common
业务 UI 贴图 Assets/Bundles/UI/Texture/<Module>
UI Prefab Assets/Bundles/UI/Prefab
UI 字体 Assets/Bundles/UI/Font(源文件 siyuan_CN_Bold.otf,TMP:siyuan_CN_Bold SDF.asset)
JSON 描述 仓库根 Doc/UIPrefabCreater
热更 UI 脚本 Assets/HotUpdate/Scripts/UI
AOT 启动条 Assets/AOT/Scripts/UI(仅补丁/启动,不放业务面板)

UI 挂载层级

运行时挂到 UIRoot 子节点(待实现时保持约定):

  • HUD → Normal → Dialog → Tips(越上越前)

UI 制作流程

  1. 设计竖屏界面;优先复用 Common 切图(Doc/UI_Normal_Set.md / UI_Pic_Set.md)。
  2. 输出 Doc/UIPrefabCreater/{UIName}.json(契约见 UIGenerationPrompt.md)。
  3. Unity 获焦自动生成 Prefab,或菜单 Tools/UI/...。
  4. HotUpdate C# 接管:按名找节点,异步加载资源。
  5. 新贴图走 ResourceCreate.md,登记 Doc/ResDesc_Picture.md。

JSON → Prefab 要点

  • referenceResolution: [1080, 1920]
  • 文字:仅 TextMeshPro,默认字体 Assets/Bundles/UI/Font/siyuan_CN_Bold SDF.asset(由 siyuan_CN_Bold.otf 生成,动态图集);浅色字描边/阴影非纯黑。
  • 九宫格:imageType: Sliced
  • 按钮:SpriteSwap 优先
  • MonoBehaviour.typeName 指向 HotUpdate 类型

资源加载

  • 一律异步(YooAsset);禁止新写同步加载热更资源。
  • Prefab/贴图路径建议带 Assets/Bundles/...。

与图集方案关系

  • 现阶段允许 Common 下单图 Sprite 直接被 Prefab 引用。
  • 目录级自动 SpriteAtlas / 打包绑定见 Doc/UI_Atlas_Pipeline.md(后续里程碑)。

Agent 边界

遵守 UNITY-GUIDE.md:可直接改 JSON/MD/C#;不手改 .prefab/.meta;Prefab 由转换器或 Pipeline 生成。