ui

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Determine the appropriate UI system for the project and route to the correct specialized skill.
确定项目适用的UI系统,并将需求路由至对应的专业技能模块。

When to Route vs Answer Directly

何时路由 vs 直接回答

Route to a specialized skill when:
  • User wants to understand, edit, or generate specific UI elements
  • User references specific files or UI objects
  • User asks for UI changes or creation
Answer directly (without routing) when:
  • User asks comparative/educational questions ("What's the difference between UI Toolkit and uGUI?")
  • User asks about UI system capabilities or recommendations ("Should I use UITK or uGUI for mobile?")
  • User needs conceptual explanation of Unity UI architecture
需路由至专业技能模块的情况:
  • 用户希望理解、编辑或生成特定UI元素
  • 用户提及特定文件或UI对象
  • 用户要求进行UI修改或创建
直接回答(无需路由)的情况:
  • 用户提出对比/知识性问题(如“UI Toolkit和uGUI有什么区别?”)
  • 用户询问UI系统的能力或选型建议(如“移动端应该用UITK还是uGUI?”)
  • 用户需要Unity UI架构的概念性解释

Routing Logic

路由逻辑

Step 1: Check for explicit file references or keywords:
User mentionsRoute to
.uxml
or
.uss
files (including in
/Editor/
)
ui-uitk
"UI Toolkit", "UITK", "UIElements", "CreateGUI"
ui-uitk
Canvas prefabs/objects,
.prefab
with UI
ui-ugui
"uGUI", "Canvas", "RectTransform", "legacy UI"
ui-ugui
"IMGUI", "OnGUI", "OnInspectorGUI", "immediate mode"
ui-imgui
Figma URL (
figma.com/design/...
), "Figma", "import from Figma"
Not available — see below
For editor-related requests (EditorWindow, custom inspector, PropertyDrawer):
  • If no explicit UI system mentioned → Go to Step 2 to detect project's editor UI system
  • If no existing pattern is detected, default to
    ui-uitk
    for new editor UI
  • Only use
    ui-imgui
    if project exclusively uses IMGUI or user explicitly requests it
If explicit file or keywords found, activate the corresponding skill immediately.
Step 2: If ambiguous, detect from project:
Search the project to determine which UI system is in use:
Look forIndicates
.uxml
or
.uss
files (including in
/Editor/
)
UI Toolkit (runtime or editor)
UIDocument
components in scenes
UI Toolkit (runtime)
Editor scripts with
CreateGUI()
method
UI Toolkit (editor)
Canvas
in scenes/prefabs
uGUI
RectTransform
heavy usage
uGUI
Editor scripts with
OnGUI()
or
OnInspectorGUI()
IMGUI (legacy editor)
Step 3: If still unclear, ask or default:
  • For existing projects: detect and follow whichever framework is already in use (Step 2)
  • For new projects with no UI yet: ask the user which framework they prefer (UI Toolkit vs uGUI), briefly explaining that UI Toolkit is modern/CSS-like while uGUI is Canvas-based/mature
  • For new runtime/game UI where the user has no preference: default to uGUI (
    ui-ugui
    )
  • When the user mentions mobile/performance constraints or older Unity versions (pre-6.0): bias toward uGUI (
    ui-ugui
    )
步骤1:检查是否有明确的文件引用或关键词:
用户提及内容路由至
.uxml
.uss
文件(包括
/Editor/
目录下的文件)
ui-uitk
"UI Toolkit"、"UITK"、"UIElements"、"CreateGUI"
ui-uitk
Canvas预制件/对象、包含UI的
.prefab
文件
ui-ugui
"uGUI"、"Canvas"、"RectTransform"、"legacy UI"
ui-ugui
"IMGUI"、"OnGUI"、"OnInspectorGUI"、"immediate mode"
ui-imgui
Figma链接(
figma.com/design/...
)、"Figma"、"从Figma导入"
暂不支持——见下文说明
针对编辑器相关请求(EditorWindow、自定义检视面板、PropertyDrawer):
  • 若未明确提及UI系统 → 进入步骤2,检测项目的编辑器UI系统
  • 若未检测到现有模式,新编辑器UI默认使用
    ui-uitk
  • 仅当项目完全使用IMGUI或用户明确要求时,才使用
    ui-imgui
若检测到明确的文件或关键词,立即激活对应的技能模块。
步骤2:若存在歧义,从项目中检测:
搜索项目以确定正在使用的UI系统:
查找内容对应系统
.uxml
.uss
文件(包括
/Editor/
目录下的文件)
UI Toolkit(运行时或编辑器)
场景中的
UIDocument
组件
UI Toolkit(运行时)
包含
CreateGUI()
方法的编辑器脚本
UI Toolkit(编辑器)
场景/预制件中的
Canvas
uGUI
大量使用
RectTransform
uGUI
包含
OnGUI()
OnInspectorGUI()
的编辑器脚本
IMGUI(旧版编辑器)
步骤3:若仍不明确,询问用户或使用默认值:
  • 对于现有项目:遵循步骤2中检测到的已使用框架
  • 对于尚未搭建UI的新项目:询问用户偏好的框架(UI Toolkit vs uGUI),并简要说明UI Toolkit是现代类CSS风格,而uGUI是基于Canvas的成熟系统
  • 对于用户无偏好的新运行时/游戏UI:默认使用uGUI(
    ui-ugui
  • 当用户提及移动端/性能限制或旧版本Unity(6.0之前):优先选择uGUI(
    ui-ugui

Request Types

请求类型

Specialized skills handle three types of requests:
TypeExamples
Understanding"What does this button do?", "How is this laid out?", "Explain this UI"
Editing"Change this color", "Add a label here", "Fix this layout"
Generation"Create a menu", "Make an inventory screen", "Build a settings panel"
Route all types to the appropriate specialized skill based on the UI system.
专业技能模块处理三类请求:
类型示例
理解类“这个按钮的功能是什么?”、“这个布局是如何实现的?”、“解释这个UI的结构”
编辑类“修改这个颜色”、“在这里添加一个标签”、“修复这个布局问题”
生成类“创建一个菜单”、“制作一个 inventory 界面”、“搭建一个设置面板”
根据UI系统将所有类型的请求路由至对应的专业技能模块。

Available Sub-Skills

可用子技能模块

UI Toolkit —
ui-uitk

UI Toolkit —
ui-uitk

  • For Unity 6.0+ projects using UI Toolkit (runtime game UI and editor tools)
  • Understands, edits, and generates
    .uxml
    and
    .uss
    files
  • Modern, CSS-like styling approach
  • Preferred for new editor windows (CreateGUI) and existing UI Toolkit projects
  • 适用于使用UI Toolkit的Unity 6.0+项目(运行时游戏UI和编辑器工具)
  • 支持理解编辑生成
    .uxml
    .uss
    文件
  • 采用现代类CSS的样式设计方式
  • 是新编辑器窗口(CreateGUI)和现有UI Toolkit项目的首选方案

uGUI —
ui-ugui

uGUI —
ui-ugui

  • For projects using Unity's Canvas-based UI system
  • Understands, edits, and generates Canvas hierarchies
  • Uses Layout Groups for responsive design
  • Default for new runtime/game UI when the user has no framework preference
  • 适用于使用Unity基于Canvas的UI系统的项目
  • 支持理解编辑生成Canvas层级结构
  • 使用Layout Groups实现响应式设计
  • 当用户无框架偏好时,是新运行时/游戏UI的默认选择

IMGUI —
ui-imgui

IMGUI —
ui-imgui

  • For legacy editor tools using OnGUI/immediate mode
  • Only use when project has existing IMGUI editor code or user explicitly requests IMGUI
  • Understands, edits, and generates EditorWindow, inspectors, PropertyDrawers built with OnGUI
  • Not for runtime game UI — for new editor tools, use UI Toolkit unless the project already uses IMGUI exclusively
  • 适用于使用OnGUI/即时模式的旧版编辑器工具
  • 仅当项目已有IMGUI编辑器代码或用户明确要求时使用
  • 支持理解编辑生成基于OnGUI的EditorWindow、检视面板、PropertyDrawers
  • 不适用于运行时游戏UI——对于新编辑器工具,除非项目完全使用IMGUI,否则优先使用UI Toolkit

Figma design import — not available here

Figma设计导入 — 暂不支持

Importing a Figma design requires Unity's Figma integration service, which only exists inside Unity AI Assistant. There is no client-side equivalent, so do not promise it.
If the user brings a Figma URL, say the automated import is not available here and offer the alternative: ask them to describe or screenshot the screen, then build it with the appropriate framework skill above.
导入Figma设计需要Unity的Figma集成服务,该服务仅在Unity AI Assistant中提供,目前无客户端等效功能,因此请勿承诺支持。
若用户提供Figma链接,请告知此处不支持自动导入,并提供替代方案:请用户描述或截图界面,再使用上述合适的框架技能模块进行搭建。

Common Guidelines (All UI Systems)

通用准则(所有UI系统)

Scope Discipline

范围规范

Do only what is requested:
  • Question → answer without making changes
  • Targeted edit → modify only what's specified
  • Generation → create only requested files
  • Don't proactively add scripts unless explicitly asked
These do NOT imply scripts:
  • "proper buttons" → well-styled buttons
  • "working UI" → valid UI that renders
  • "menu screen" → visual layout only
仅执行请求内容:
  • 问题 → 直接回答,不进行修改
  • 针对性编辑 → 仅修改指定内容
  • 生成请求 → 仅创建所需文件
  • 除非明确要求,否则不要主动添加脚本
以下表述不意味着需要添加脚本:
  • “功能完善的按钮” → 样式美观的按钮
  • “可运行的UI” → 能正常渲染的有效UI
  • “菜单界面” → 仅视觉布局

Conventions

约定

Follow project patterns first. Search existing files before applying defaults.
TypeConvention
Element namesFollow project patterns, or camelCase
File organizationMatch existing project structure
优先遵循项目现有模式。在应用默认规则前,先搜索现有文件。
类型约定
元素命名遵循项目现有模式,或使用小驼峰命名法
文件组织匹配现有项目结构

Workflow

工作流程

  1. Determine UI system — Use routing logic above
    • For Figma requests, tell the user the automated import is not available here, then work from their description or screenshot and continue with framework detection
  2. Activate specialized skill — Route to
    ui-uitk
    ,
    ui-ugui
    , or
    ui-imgui
  3. Skill handles request — Understanding, editing, or generation as appropriate
  1. 确定UI系统 — 使用上述路由逻辑
    • 对于Figma请求,告知用户此处不支持自动导入,然后根据用户的描述或截图继续进行框架检测
  2. 激活专业技能模块 — 路由至
    ui-uitk
    ui-ugui
    ui-imgui
  3. 技能模块处理请求 — 根据需求进行理解、编辑或生成操作

Handling Mixed Projects

混合项目处理

Many Unity projects use multiple UI systems simultaneously (e.g., UI Toolkit for runtime game UI plus editor tools). When you detect multiple systems:
  • For runtime UI requests (menus, HUDs, game screens) → Route to whichever runtime system (UITK or uGUI) is already in use
  • For editor tool requests (custom inspectors, editor windows):
    • Prefer UI Toolkit (CreateGUI) for new editor UI — it's the modern approach
    • Only use IMGUI if the project's existing editor tools use IMGUI exclusively, or user explicitly requests IMGUI
    • Check for existing editor
      .uxml
      files to confirm UITK usage
  • If creating new runtime UI in a mixed project → Match the pattern used by similar existing UI; if there is no similar existing UI and the user has no preference, use uGUI
许多Unity项目会同时使用多种UI系统(例如,运行时游戏UI使用UI Toolkit,编辑器工具使用其他系统)。当检测到多种系统时:
  • 对于运行时UI请求(菜单、HUD、游戏界面) → 路由至已在使用的运行时系统(UITK或uGUI)
  • 对于编辑器工具请求(自定义检视面板、编辑器窗口):
    • 优先选择UI Toolkit(CreateGUI)开发新编辑器UI——这是现代化方案
    • 仅当项目现有编辑器工具完全使用IMGUI,或用户明确要求时,才使用IMGUI
    • 检查现有编辑器
      .uxml
      文件以确认是否使用UITK
  • 在混合项目中创建新运行时UI → 匹配现有同类UI的模式;若没有同类现有UI且用户无偏好,则使用uGUI