unity-editor-tooling

v2026.09.24

Unity Editor scripting — custom Inspectors, PropertyDrawers, EditorWindow, MenuItems, asset post-processors, Editor Coroutines, automated builds via `-batchmode -executeMethod`. USE WHEN: building tools for designers, custom Inspector UI, gizmos, scene validators, asset import hooks, editor menu commands, headless CI builds. DO NOT USE FOR: runtime UI (use `unity-input-ui`); test runner (use `unity-testing`).

GitHub
Install command
npx skhub add claude-dev-suite/unity-editor-tooling
Markdown
SKILL.md

Unity Editor Tooling

Asmdef layout for editor code

Assets/
  Scripts/
    Runtime.asmdef          (no editor refs)
    Editor.asmdef           (Include Platforms = Editor only)
      depends on Runtime + UnityEditor

Editor code never ships in player builds — keep it isolated.

Custom Inspector

[CustomEditor(typeof(EnemySpawner))]
public class EnemySpawnerEditor : Editor {
    public override void OnInspectorGUI() {
        DrawDefaultInspector();

        var spawner = (EnemySpawner)target;
        EditorGUILayout.Space();
        if (GUILayout.Button("Spawn Test Wave")) {
            if (Application.isPlaying) spawner.SpawnTestWave();
            else Debug.LogWarning("Enter Play Mode first.");
        }
    }
}

Prefer UI Toolkit Inspectors (UXML/USS) for complex tools — better composition than IMGUI.

PropertyDrawer

[CustomPropertyDrawer(typeof(MinMaxRangeAttribute))]
public class MinMaxRangeDrawer : PropertyDrawer {
    public override void OnGUI(Rect r, SerializedProperty p, GUIContent l) {
        var attr = (MinMaxRangeAttribute)attribute;
        var min = p.FindPropertyRelative("min");
        var max = p.FindPropertyRelative("max");
        EditorGUI.MinMaxSlider(r, l, ref min.floatValue, ref max.floatValue, attr.Min, attr.Max);
    }
}

EditorWindow

public class LevelToolsWindow : EditorWindow {
    [MenuItem("Tools/Level Tools")]
    public static void Show() => GetWindow<LevelToolsWindow>("Level Tools");

    private void OnGUI() {
        if (GUILayout.Button("Bake Lighting")) Lightmapping.BakeAsync();
        if (GUILayout.Button("Validate Scene")) ValidateActiveScene();
    }
}

Asset post-processor

Auto-fix import settings for new sprites:

public class SpriteImporter : AssetPostprocessor {
    void OnPreprocessTexture() {
        if (!assetPath.Contains("/Sprites/")) return;
        var ti = (TextureImporter)assetImporter;
        ti.textureType = TextureImporterType.Sprite;
        ti.spritePixelsPerUnit = 32;
        ti.filterMode = FilterMode.Point;
        ti.textureCompression = TextureImporterCompression.Uncompressed;
    }
}

Headless builds (-batchmode)

public static class CIBuild {
    [MenuItem("Build/Build Windows")]
    public static void BuildWindows() {
        var opts = new BuildPlayerOptions {
            scenes = new[] { "Assets/Scenes/Boot.unity", "Assets/Scenes/Main.unity" },
            locationPathName = "Build/Win64/Game.exe",
            target = BuildTarget.StandaloneWindows64,
            options = BuildOptions.None,
        };
        var report = BuildPipeline.BuildPlayer(opts);
        if (report.summary.result != BuildResult.Succeeded)
            EditorApplication.Exit(1);
    }
}

CI invocation:

Unity -batchmode -nographics -quit \
  -projectPath . \
  -executeMethod CIBuild.BuildWindows \
  -logFile -

Combine with Addressables.BuildPlayerContent() before player build to prep content.

Anti-patterns

Anti-patternFix
Editor code mixed in Runtime asmdefSplit asmdef; gate with #if UNITY_EDITOR for one-offs
Heavy logic in OnInspectorGUICache, only recompute on EditorUtility.SetDirty events
EditorPrefs for project-shared stateUse ProjectSettings or assets in repo
Reflection-driven Inspectors with no fallbackAlways provide DrawDefaultInspector path

Production checklist

  • All custom tools have menu entries under Tools/ namespace
  • Asset post-processors enforce import settings (sprites, audio, models)
  • CI builds run via -batchmode -executeMethod
  • Editor analytics (Analytics.RegisterEvent) opt-in only, scrubbed of PII
  • Editor coroutines used for long-running tools (don't freeze UI)
Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.24

Published

Sep 24, 2026

Category

Uncategorized

License

MIT

Source path

skills/gamedev/unity-editor-tooling

Default branch

main

Latest commit

9496306

Tree SHA

fe4e2f1