Update nexus wiki content
This commit is contained in:
@@ -9,41 +9,52 @@ date: 2026-04-26
|
||||
- [[raw/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 前自动拦截,在创意人员意识到需求前提前自动化
|
||||
- 核心主题:Unity Editor 扩展开发专家 Agent——通过 EditorWindow、PropertyDrawer、AssetPostprocessor、Build Validation 等自动化工具,减少团队手动操作时间、提前拦截错误
|
||||
- 问题域:游戏项目 Editor 自动化工作流、美术/策划/程序团队的日常效率提升、构建前质量门控
|
||||
- 方法/机制:Editor-only 代码规范(`Editor` 文件夹 / `#if UNITY_EDITOR` / asmdef 隔离)→ 工具原型验证 → 量产化(含 Undo/ProgressBar/持久化)→ Build Validation 集成
|
||||
- 结论/价值:提供完整的 Unity Editor 工具开发规范,包括 4 类核心 API(EditorWindow/PropertyDrawer/AssetPostprocessor/IPreprocessBuildWithReport)的代码模板与质量标准
|
||||
|
||||
## 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`
|
||||
- 所有 Editor 脚本必须位于 `Editor` 文件夹或使用 `#if UNITY_EDITOR` 守卫——Editor API 调用进入运行时程序集会导致构建失败
|
||||
- AssetPostprocessor 必须幂等:同一资源导入两次必须产生相同结果
|
||||
- PropertyDrawer.OnGUI 必须调用 `EditorGUI.BeginProperty` / `EndProperty`,否则 Prefab Override UI 将无法正常工作
|
||||
- EditorWindow 工具必须通过 `[SerializeField]` 或 `EditorPrefs` 持久化状态,否则 Domain Reload 后状态丢失
|
||||
- 任何修改 inspector 显示对象的操作必须先调用 `Undo.RecordObject`,否则操作无法撤销,属于用户敌对行为
|
||||
- 耗时超过 0.5 秒的操作必须显示 `EditorUtility.DisplayProgressBar`,否则 UI 会冻结
|
||||
|
||||
## 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." — 开发者体验优先于功能堆砌
|
||||
> "Every EditorWindow tool must persist state across domain reloads using `[SerializeField]` on the window class or `EditorPrefs`" — Domain Reload 状态持久化规范
|
||||
> "Tools must show progress via `EditorUtility.DisplayProgressBar` for any operation taking > 0.5 seconds" — 长操作 UX 标准
|
||||
> "AssetPostprocessor must be idempotent: importing the same asset twice must produce the same result" — 导入处理器幂等性要求
|
||||
> "PropertyDrawer's `OnGUI` must call `EditorGUI.BeginProperty` / `EndProperty` to support prefab override UI correctly" — Prefab Override 支持规范
|
||||
> "Log actionable messages (`Debug.LogWarning`) when postprocessor overrides a setting — silent overrides confuse artists" — 静默覆盖之害
|
||||
|
||||
## Key Concepts
|
||||
- [[EditorWindow]]:Unity 编辑器窗口扩展基类,用于构建团队可见的编辑器工具(资产审计、资源统计、验证面板)
|
||||
- [[AssetPostprocessor]]:Unity 资源导入拦截器,在资源导入时自动强制执行命名规范、压缩设置、平台配置,确保每次导入结果一致且幂等
|
||||
- [[PropertyDrawer]]:自定义 Inspector 属性绘制器,扩展编辑器中序列化类型的显示方式,支持 MinMax Slider 等复合控件
|
||||
- [[AssemblyDefinitionFiles]]:`.asmdef` 文件用于在编译时强制 Editor/Runtime 程序集分离,防止 UnityEditor 命名空间泄漏到构建产物
|
||||
- [[BuildValidation]]:`IPreprocessBuildWithReport` 接口允许在构建前运行检查列表,失败时抛出 `BuildFailedException` 阻止打包
|
||||
- [[EditorWindow]]:Unity Editor 扩展窗口基类,通过 `[MenuItem]` 注册菜单入口,可创建工具窗口、审计面板、检查器等 UI
|
||||
- [[PropertyDrawer]]:自定义 Inspector 属性绘制器,通过 `CustomPropertyDrawer` 特性关联 Serializable 类型,提供更友好的编辑器编辑体验
|
||||
- [[AssetPostprocessor]]:资源导入前置/后置处理器,在每次资源导入时自动触发,用于强制命名规范、导入设置和预算验证
|
||||
- [[CustomEditor]]:自定义 Inspector 面板,通过 `[CustomEditor(typeof(MyComponent))]` 替代默认组件检查器
|
||||
- [[AssemblyDefinition]](.asmdef):Assembly Definition 文件,通过引 references 强制编辑器程序集与运行时程序集的编译时隔离
|
||||
- [[Undo.RecordObject]]:`UnityEditor.Undo` API,在修改对象前调用,使操作可撤销——不可撤销的编辑器操作属于用户敌对行为
|
||||
- [[BuildValidation]](IPreprocessBuildWithReport):构建前验证接口,在打包前运行质量门控检查,失败时抛出 `BuildFailedException`
|
||||
- [[ScriptableBuildPipeline]]:Unity 可脚本化构建管线,替代传统构建流程,支持自定义构建任务(资产剥离/着色器变体/CDN 缓存失效)
|
||||
- [[UI Toolkit]](UIElements):Unity 新一代编辑器 UI 系统,基于 USS + VisualElement,提供响应式、可样式化的编辑器 UI,替代 IMGUI
|
||||
|
||||
## Key Entities
|
||||
- [[UnityEditorToolDeveloper]]:本 Source 对应的 AI Agent 人格——编辑器自动化专精,强调 DX、可量化的效率提升和隐形工具哲学
|
||||
- [[UnrealEditorToolDeveloper]]:对应 Unreal Engine 端的编辑器工具开发(比较视角)
|
||||
- [[UnityEditorToolDeveloper]]:Unity Editor 工具开发专家 Agent 自引用——"自动化痴迷、DX 优先、流水线第一、默默不可或缺"
|
||||
|
||||
## 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 也负责编辑器工具和资产管线)
|
||||
- [[UnityEditorToolDeveloper]] ← authored_by ← [[TechnicalArtist]](Technical Artist 可能审查或指导工具开发输出)
|
||||
- [[EditorWindow]] ← enables ← [[UnityEditorToolDeveloper]](EditorWindow 是构建工具窗口的核心 API)
|
||||
- [[AssetPostprocessor]] ← enables ← [[UnityEditorToolDeveloper]](AssetPostprocessor 是自动拦截错误资产的核心机制)
|
||||
- [[PropertyDrawer]] ← enables ← [[UnityEditorToolDeveloper]](PropertyDrawer 是改善 Inspector 体验的核心 API)
|
||||
- [[UnityEditorToolDeveloper]] ← extends ← [[UnityShaderGraphArtist]](Shader Graph Artist 依赖工具开发者构建编辑器辅助面板)
|
||||
- [[UnityEditorToolDeveloper]] ← extends ← [[UnityMultiplayerEngineer]](多人工程师依赖工具开发者构建网络调试窗口)
|
||||
- [[UI Toolkit]] ← replaces ← [[EditorWindow]](UI Toolkit 是 EditorWindow 的下一代演进方向)
|
||||
|
||||
## Contradictions
|
||||
- 与 [[unreal-systems-engineer]] 在"编辑器工具 vs. 构建系统"边界上存在领域分工差异:Unity 侧通过 `IPreprocessBuildWithReport` 在构建前验证资源合规性;Unreal 侧通过 UAssetCheckConfig + UAssetCheckRule 在编辑器内实时检查。两者的目标相同(防止问题到达 QA),但实现时机和 API 不同——属互补而非冲突。
|
||||
- 与 [[UnrealTechnicalArtist]] 关于 Editor 扩展方案:
|
||||
- 冲突点:Unity 使用 PropertyDrawer / CustomEditor / EditorWindow 方案,Unreal 使用 Details Panel Customization / EditorUtility / SWidget 方案
|
||||
- 当前观点:Unity Editor Tool Developer 认为 PropertyDrawer + AssetPostprocessor 组合可覆盖 90% 的编辑器自动化场景
|
||||
- 对方观点:Unreal Technical Artist 更偏好编辑器蓝图/编辑器模块化方案而非手写 C++
|
||||
- 说明:两者均为各自平台的最佳实践,冲突源于引擎架构差异而非绝对优劣
|
||||
|
||||
Reference in New Issue
Block a user