← UnityCONTENT HISTORY

Update to Unity

Snapshot Sep 30, 2026 · 23:16 UTC · version 0.1.6-beta

Collection source: not recorded for this historical snapshot.

WHAT CHANGED · RULE-BASED ANALYSIS

First saved snapshot

No earlier snapshot is available to establish a change.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "description": "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.",
  "included_files": [
    {
      "relative_path": "references/gui-elements.md",
      "size_in_bytes": 3616
    },
    {
      "relative_path": "references/templates.md",
      "size_in_bytes": 2710
    }
  ],
  "name": "ui-imgui",
  "skill_md_contents": "---\nname: ui-imgui\ndescription: 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.\n---\n\n**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:\n- User is modifying existing IMGUI code\n- User explicitly requests IMGUI/immediate mode\n- The project exclusively uses IMGUI for editor tools\n\nWhen activated, read the reference files:\n- [references/templates.md](references/templates.md) — EditorWindow, Inspector, PropertyDrawer templates\n- [references/gui-elements.md](references/gui-elements.md) — GUI elements, layout groups, styling\n\n## When to Use This Skill\n\n**IMPORTANT:** This skill is for **legacy IMGUI code only**. Use this skill when:\n\n- User is maintaining/updating **existing** IMGUI editor code (files with `OnGUI()`, `OnInspectorGUI()`)\n- User **explicitly requests** IMGUI/immediate mode GUI\n- Project exclusively uses IMGUI for all editor tools\n\n**Do NOT use this skill for:**\n- New editor windows (use UI Toolkit with `CreateGUI()` instead)\n- New custom inspectors (use UI Toolkit instead)\n- Requests that don't explicitly mention IMGUI or OnGUI\n\n**Legacy IMGUI is used for:**\n- **Editor windows** — `EditorWindow` classes with `OnGUI()`\n- **Custom inspectors** — `Editor`, `PropertyDrawer` classes with `OnInspectorGUI()`\n- **Debug overlays** — `OnGUI()` in MonoBehaviour (runtime)\n\nIMGUI is **not** for runtime game UI — use UI Toolkit or uGUI instead.\n\n## Scope\n\n**Generate only what is requested (for legacy IMGUI code):**\n\n| Request | Output | Note |\n|---------|--------|------|\n| Editor window (IMGUI/OnGUI) | `EditorWindow` with `OnGUI()` | Only if explicitly IMGUI |\n| Custom inspector (IMGUI) | `Editor` with `OnInspectorGUI()` | Only if explicitly IMGUI |\n| Property drawer (IMGUI) | `PropertyDrawer` with `OnGUI()` | Only if explicitly IMGUI |\n| Debug overlay | `MonoBehaviour` with `OnGUI()` | Runtime debugging |\n| Update existing IMGUI script | Modify existing OnGUI code | Always appropriate |\n\n**Clarify if ambiguous:**\n- \"inspector\" → Custom Editor for a specific type, or PropertyDrawer? **Also ask:** Should this use UI Toolkit (modern) or IMGUI (legacy)?\n- \"editor window\" → **First ask:** Should this use UI Toolkit (modern/CreateGUI) or IMGUI (legacy/OnGUI)?\n- \"tool window\" → EditorWindow with what functionality? Which UI system?\n\n## Conventions\n\n**Follow project patterns first.** Search existing editor scripts before applying defaults.\n\n| Type | Convention | Good | Bad |\n|------|------------|------|-----|\n| Script names | PascalCase | `MyToolWindow.cs` | `my-tool-window.cs` |\n| EditorWindow | `[Name]Window.cs` | `LevelEditorWindow.cs` | `LevelEditor.cs` |\n| Custom Editor | `[Type]Editor.cs` | `EnemyEditor.cs` | `EnemyInspector.cs` |\n| PropertyDrawer | `[Type]Drawer.cs` | `RangeDrawer.cs` | `RangePropertyDrawer.cs` |\n| Location | `Editor` folder | `Assets/Editor/` | `Assets/Scripts/` |\n\n**Editor folder is required** — Scripts using `UnityEditor` namespace must be in an `Editor` folder or they will fail to build.\n\n## Workflow\n\n1. **Analyze** — Determine script type needed (EditorWindow, Editor, PropertyDrawer, etc.)\n2. **Search** — Find existing editor scripts to match patterns\n3. **Follow project patterns** — Match folder structure and naming\n4. **Create script** — Use appropriate base class and attributes\n5. **Implement OnGUI** — Build the interface with layout groups\n\n## Script Structure\n\n### EditorWindow\n```\n[MenuItem attribute] → adds to menu\nShowWindow() static method → opens window\nOnGUI() → draws interface\nOnEnable/OnDisable → initialization/cleanup\n```\n\n### Custom Editor\n```\n[CustomEditor attribute] → targets component type\nOnInspectorGUI() → draws inspector\nOnEnable() → cache SerializedProperties\nserializedObject.Update/ApplyModifiedProperties → undo support\n```\n\n### PropertyDrawer\n```\n[CustomPropertyDrawer attribute] → targets type or attribute\nOnGUI(Rect, SerializedProperty, GUIContent) → draws property\nGetPropertyHeight() → custom height if needed\n```\n\n## Key Rules\n\n- **Cache GUIStyle objects** — never create new GUIStyle in OnGUI (causes memory allocation every frame)\n- **Use SerializedProperty** — for proper undo/redo support in inspectors\n- **Call ApplyModifiedProperties()** — after any serialized object changes\n- **Use EditorGUILayout** — for editor scripts (auto-layout)\n- **Use GUILayout** — for runtime OnGUI\n- **Begin/End pairs** — always match BeginHorizontal with EndHorizontal, etc.\n- **Editor folder required** — scripts fail to build if not in Editor folder\n\n## Layout Basics\n\n**Horizontal grouping:**\n```csharp\nEditorGUILayout.BeginHorizontal();\n// elements appear side by side\nEditorGUILayout.EndHorizontal();\n```\n\n**Vertical grouping:**\n```csharp\nEditorGUILayout.BeginVertical(\"box\");\n// elements appear stacked, with box style\nEditorGUILayout.EndVertical();\n```\n\n**Scroll view:**\n```csharp\nscrollPos = EditorGUILayout.BeginScrollView(scrollPos);\n// scrollable content\nEditorGUILayout.EndScrollView();\n```\n\n**Foldout section:**\n```csharp\nshowSection = EditorGUILayout.Foldout(showSection, \"Section Name\");\nif (showSection)\n{\n    EditorGUI.indentLevel++;\n    // section content\n    EditorGUI.indentLevel--;\n}\n```\n\n## Common Patterns\n\n**Button with action:**\n```csharp\nif (GUILayout.Button(\"Do Something\"))\n{\n    // action here\n}\n```\n\n**Property field with label:**\n```csharp\nEditorGUILayout.PropertyField(myProperty, new GUIContent(\"Label\"));\n```\n\n**Object reference field:**\n```csharp\nmyObject = (MyType)EditorGUILayout.ObjectField(\"Label\", myObject, typeof(MyType), true);\n```\n\n**Disabled group:**\n```csharp\nEditorGUI.BeginDisabledGroup(condition);\n// disabled elements\nEditorGUI.EndDisabledGroup();\n```\n\n## Best Practices\n\n- Use `SerializedObject` and `SerializedProperty` for undo support\n- Cache property references in `OnEnable()`\n- Use `EditorUtility.SetDirty()` only for non-serialized changes\n- Use `Undo.RecordObject()` before modifying objects directly\n- Use `EditorStyles` for consistent appearance\n- Use `GUILayout.FlexibleSpace()` to push elements apart\n\nSee `references/templates.md` for complete script templates.\nSee `references/gui-elements.md` for full element reference.\n"
}

SHA-256 of public snapshot: 874580ea95c3a774f4802bcafbdf997b8266cdca75d514b5492a5c25051e1e50