# UIInfoBuilder Unity UI Prefab 信息提取工具,将 Prefab 层级结构和组件属性导出为 JSON 文件。 ## 用途 - 提取 UI Prefab 的完整结构信息 - 便于 AI 理解和分析 UI 界面 - 支持 UI 文档化和版本对比 ## 使用方法 1. 在 Project 窗口选择 Prefab 2. 右键 -> `UIInfoBuilder/ExtractPrefab` 3. JSON 保存到 `项目根目录/ExtractedPrefabs/` ## 架构 ``` UIInfoBuilder/ ├── UIInfoExtractor.cs # 主入口,递归遍历节点 ├── Data/ │ ├── UIInfoNode.cs # 节点数据结构 │ └── UIInfoComponent.cs # 组件数据结构 └── ComponentExtractors/ ├── IComponentExtractor.cs # 提取器接口 ├── DefaultComponentExtractor.cs # 默认反射提取 ├── RectTransformExtractor.cs # RectTransform 精细提取 ├── ImageExtractor.cs # Image 精细提取 ├── TextExtractor.cs # Text/TMP 精细提取 └── ButtonExtractor.cs # Button 精细提取 ``` ## 扩展 添加新组件提取器: 1. 实现 `IComponentExtractor` 接口 2. 在 `UIInfoExtractor` 静态构造函数中注册