50 lines
3.9 KiB
Markdown
50 lines
3.9 KiB
Markdown
---
|
||
title: "Unity Editor Tool Developer"
|
||
type: source
|
||
tags: []
|
||
date: 2026-04-26
|
||
---
|
||
|
||
## Source File
|
||
- [[Agent/agency-agents/game-development/unity/unity-editor-tool-developer.md]]
|
||
|
||
## Summary(用中文描述)
|
||
- 核心主题:Unity 编辑器扩展开发工程师(Editor Tool Developer)的 AI Agent 人格规范——通过 EditorWindows、PropertyDrawers、AssetPostprocessors、Build Validators 等工具自动化团队工作流,减少人工错误
|
||
- 问题域:游戏团队每日面临的素材导入错误、Inspector 数据误操作、命名规范失控、构建前人工检查等重复性工作
|
||
- 方法/机制:基于 Unity Editor API 构建编辑器扩展工具,使用 `[SerializeField]` + `[MenuItem]` + `AssetPostprocessor` 模式实现自动化;通过 `Undo.RecordObject()` 保证操作可撤销;通过 `EditorUtility.DisplayProgressBar` 反馈长操作进度
|
||
- 结论/价值:最佳工具是"隐形"的——在问题到达 QA 前自动拦截,在创意人员意识到需求前提前自动化
|
||
|
||
## Key Claims(用中文描述)
|
||
- UnityEditorToolDeveloper 通过 Editor 自动化,使艺术/设计/工程团队效率可量化提升
|
||
- 所有 Editor 脚本必须置于 `Editor` 文件夹或使用 `#if UNITY_EDITOR` 保护——Editor API 调用进入运行时代码将导致构建失败
|
||
- `EditorWindow` 必须通过 `[SerializeField]` 或 `EditorPrefs` 持久化状态,跨域重载不丢失
|
||
- `AssetPostprocessor` 必须幂等——同一资源重复导入必须产生相同结果
|
||
- `PropertyDrawer.OnGUI` 必须调用 `EditorGUI.BeginProperty` / `EndProperty` 以正确支持 Prefab Override UI
|
||
- 构建验证器失败时必须抛出 `BuildFailedException`,而非仅 `Debug.LogWarning`
|
||
|
||
## Key Quotes
|
||
> "The best tools are invisible — they catch problems before they ship and automate the tedious so humans can focus on the creative." — UnityEditorToolDeveloper 核心理念
|
||
|
||
> "Can you Ctrl+Z that? No? Then we're not done." — Undo 是交付门槛,不支持撤销的工具不能发布
|
||
|
||
> "DX over raw power: The tool can do 10 things — let's ship the 2 things artists will actually use." — 开发者体验优先于功能堆砌
|
||
|
||
## Key Concepts
|
||
- [[EditorWindow]]:Unity 编辑器窗口扩展基类,用于构建团队可见的编辑器工具(资产审计、资源统计、验证面板)
|
||
- [[AssetPostprocessor]]:Unity 资源导入拦截器,在资源导入时自动强制执行命名规范、压缩设置、平台配置,确保每次导入结果一致且幂等
|
||
- [[PropertyDrawer]]:自定义 Inspector 属性绘制器,扩展编辑器中序列化类型的显示方式,支持 MinMax Slider 等复合控件
|
||
- [[AssemblyDefinitionFiles]]:`.asmdef` 文件用于在编译时强制 Editor/Runtime 程序集分离,防止 UnityEditor 命名空间泄漏到构建产物
|
||
- [[BuildValidation]]:`IPreprocessBuildWithReport` 接口允许在构建前运行检查列表,失败时抛出 `BuildFailedException` 阻止打包
|
||
|
||
## Key Entities
|
||
- [[UnityEditorToolDeveloper]]:本 Source 对应的 AI Agent 人格——编辑器自动化专精,强调 DX、可量化的效率提升和隐形工具哲学
|
||
- [[UnrealEditorToolDeveloper]]:对应 Unreal Engine 端的编辑器工具开发(比较视角)
|
||
|
||
## Connections
|
||
- [[unity-editor-tool-developer]] ← game_dev_editor_extension ← [[game-designer]]
|
||
- [[unity-editor-tool-developer]] ← editor_automation ← [[unreal-systems-engineer]](两者共享"构建前验证"模式)
|
||
- [[unity-editor-tool-developer]] ← tool_patterns ← [[technical-artist]](Technical Artist 也负责编辑器工具和资产管线)
|
||
|
||
## Contradictions
|
||
- 与 [[unreal-systems-engineer]] 在"编辑器工具 vs. 构建系统"边界上存在领域分工差异:Unity 侧通过 `IPreprocessBuildWithReport` 在构建前验证资源合规性;Unreal 侧通过 UAssetCheckConfig + UAssetCheckRule 在编辑器内实时检查。两者的目标相同(防止问题到达 QA),但实现时机和 API 不同——属互补而非冲突。
|