npx skills add ...
npx skills add unity-technologies/skills --skill ui-imgui
Unity IMGUI (Immediate Mode GUI) expert for legacy editor tools using OnGUI/immediate mode. Generates and modifies IMGUI EditorWindows, custom Inspectors, PropertyDrawers, and scripts with IMGUI code (OnGUI, OnInspectorGUI). Use when maintaining existing IMGUI editor code or when user explicitly requests IMGUI/OnGUI. Do not use for NEW editor windows or tools: new editor UI defaults to UI Toolkit (ui-uitk) unless the project already uses IMGUI exclusively or the user asks for OnGUI by name.
npx skills add unity-technologies/skills --skill ui-imgui
Before proceeding: If the user is asking about creating a new editor window, custom inspector, or PropertyDrawer without explicitly mentioning IMGUI/OnGUI, recommend using UI Toolkit (CreateGUI) instead, as it's the modern approach. Only proceed with IMGUI if:
When activated, read the reference files:
IMPORTANT: This skill is for legacy IMGUI code only. Use this skill when:
OnGUI(), OnInspectorGUI())Do NOT use this skill for:
CreateGUI() instead)Legacy IMGUI is used for:
EditorWindow classes with OnGUI()Editor, PropertyDrawer classes with OnInspectorGUI()OnGUI() in MonoBehaviour (runtime)IMGUI is not for runtime game UI — use UI Toolkit or uGUI instead.
Generate only what is requested (for legacy IMGUI code):
| Request | Output | Note |
|---|---|---|
| Editor window (IMGUI/OnGUI) | EditorWindow with OnGUI() | Only if explicitly IMGUI |
| Custom inspector (IMGUI) | Editor with OnInspectorGUI() | Only if explicitly IMGUI |
| Property drawer (IMGUI) | PropertyDrawer with OnGUI() | Only if explicitly IMGUI |
| Debug overlay | MonoBehaviour with OnGUI() | Runtime debugging |
| Update existing IMGUI script | Modify existing OnGUI code | Always appropriate |
Clarify if ambiguous:
Follow project patterns first. Search existing editor scripts before applying defaults.
| Type | Convention | Good | Bad |
|---|---|---|---|
| Script names | PascalCase | MyToolWindow.cs | my-tool-window.cs |
| EditorWindow | [Name]Window.cs | LevelEditorWindow.cs | LevelEditor.cs |
| Custom Editor | [Type]Editor.cs | EnemyEditor.cs | EnemyInspector.cs |
| PropertyDrawer | [Type]Drawer.cs | RangeDrawer.cs | RangePropertyDrawer.cs |
| Location | Editor folder | Assets/Editor/ | Assets/Scripts/ |
Editor folder is required — Scripts using UnityEditor namespace must be in an Editor folder or they will fail to build.
Horizontal grouping:
Vertical grouping:
Scroll view:
Foldout section:
Button with action:
Property field with label:
Object reference field:
Disabled group:
SerializedObject and SerializedProperty for undo supportOnEnable()EditorUtility.SetDirty() only for non-serialized changesUndo.RecordObject() before modifying objects directlyEditorStyles for consistent appearanceGUILayout.FlexibleSpace() to push elements apartSee references/templates.md for complete script templates.
See references/gui-elements.md for full element reference.
EditorGUILayout.BeginHorizontal();
// elements appear side by side
EditorGUILayout.EndHorizontal();EditorGUILayout.BeginVertical("box");
// elements appear stacked, with box style
EditorGUILayout.EndVertical();scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
// scrollable content
EditorGUILayout.EndScrollView();showSection = EditorGUILayout.Foldout(showSection, "Section Name");
if (showSection)
{
EditorGUI.indentLevel++;
// section content
EditorGUI.indentLevel--;
}if (GUILayout.Button("Do Something"))
{
// action here
}EditorGUILayout.PropertyField(myProperty, new GUIContent("Label"));myObject = (MyType)EditorGUILayout.ObjectField("Label", myObject, typeof(MyType), true);EditorGUI.BeginDisabledGroup(condition);
// disabled elements
EditorGUI.EndDisabledGroup();