alivirgo/Major-AI-Skills / plugins/mas-3d-games/skills/unity
unity
VerifiedAutomate Unity editor and runtime workflows with C#, Addressables, render pipelines, and batch builds.
Unity Engine C# Editor & Runtime AI Skill Guide (Claude)
Overview & Engine Architecture
Unity 6000.x / 2022 LTS+ combines Scenes, Prefabs, ScriptableObjects, URP/HDRP/Built-in RP, and Editor-only automation via -batchmode -quit -executeMethod. Claude acts as a Principal Unity Engineer: CI builds, Addressables, deterministic player settings, and Editor/runtime assembly separation.
┌─────────────────────────────────────────────────────────────┐
│ Editor (UnityEditor) → -executeMethod / BuildPipeline │
│ Player (runtime) → Mono / IL2CPP │
│ CI: one process per buildTarget; -activeBuildProfile │
└─────────────────────────────────────────────────────────────┘
Version pin: Unity Editor version in ProjectSettings/ProjectVersion.txt — CI must use the same Hub editor (e.g. 6000.0.xf1). Command-line reference.
When to use / when not to
Use when: automated builds, asset validation, playmode tests, Addressables content builds, batch import settings.
Do not use when: Unreal-specific Nanite workflows; server-side Unity without licensing review for headless batch (Unity licensing applies to build machines).
Operational Capabilities & Agent Directives
- Editor isolation:
#if UNITY_EDITOR,Assets/**/Editor/, Editor asmdefs — never referenceUnityEditorin runtime. - CI entry points:
public static void X()only;EditorApplication.Exit(code)on failure; no modal dialogs in batchmode. - One target per invocation: pass
-buildTarget StandaloneWindows64or-activeBuildProfile "Assets/.../Windows.asset"— multi-target requires separate processes. - Deterministic builds: pin graphics tiers, disable random
Application.targetFrameRateside effects in build scripts; useBuildOptions.StrictModewhere available; logApplication.unityVersion. - Color/URP: document active RP asset; linear color space + URP asset must match CI player settings or lighting differs from Editor.
- Logs: always
-logFilepath; parse forScripts have compiler errorsbefore blaming runtime.
Production C#: CI build + exit code
Assets/Editor/CiBuild.cs:
#if UNITY_EDITOR
using System.IO;
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;
public static class CiBuild
{
public static void BuildWindowsCI()
{
var ok = BuildInternal(BuildTarget.StandaloneWindows64, "Builds/Win/Game.exe");
EditorApplication.Exit(ok ? 0 : 1);
}
static bool BuildInternal(BuildTarget target, string location)
{
Directory.CreateDirectory(Path.GetDirectoryName(location)!);
var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions
{
scenes = EditorBuildSettingsScene.GetActiveSceneList(EditorBuildSettings.scenes),
locationPathName = location,
target = target,
options = BuildOptions.CompressWithLz4HC
});
Debug.Log($"Build {report.summary.result} size={report.summary.totalSize}");
return report.summary.result == BuildResult.Succeeded;
}
}
#endif
& "C:\Program Files\Unity\Hub\Editor\6000.0.42f1\Editor\Unity.exe" `
-batchmode -nographics -quit `
-projectPath "$PWD" `
-buildTarget StandaloneWindows64 `
-executeMethod CiBuild.BuildWindowsCI `
-logFile "$PWD\Logs\ci-build.log"
Addressables / content pipeline (batch)
Use AddressableAssetSettings.BuildPlayerContent() from an Editor static method after -executeMethod imports complete. Fail CI if catalog hash changes without intentional bump (store catalog.json hash artifact).
Failure taxonomy
| Symptom | Cause | Fix |
|---|---|---|
| Hang after open | Modal dialog / missing -quit | -batchmode -quit; guard DisplayDialog |
| Wrong platform shaders | Missing -buildTarget / profile | Set -activeBuildProfile |
UnityEditor in player | Editor script in runtime asmdef | Editor folder + asmdef platforms |
| Non-deterministic lighting | Different RP or color space | Serialize Quality/Graphics settings |
| License / activation | Batch on fresh VM | Unity license activation docs for CI |
Reddit/forum pattern: parallel Unity instances on same project path fail — one lock per -projectPath.
Agent Operational Directive
MANDATORY: Static
-executeMethodin Editor assembly; explicit exit codes;-logFile; pin Editor version; separate CI job per build target.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |