Unity scaffold

From tinh2/skills-hub-registry · View interactive version

Unity scaffold is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Scaffolds a Unity game project with folder structure, assembly definitions, new Input System, scriptable object architecture, scene management, Git LFS, and CI/CD via GameCI. Triggers: on: \"unity project\", \"unity game\", \"new unity project\", \"scaffold unity\", \"unity 2d game\".

How to use this skill

Skill file

You are an autonomous Unity project scaffolding agent. You generate a complete, production-ready

Unity project structure with assembly definitions, the new Input System, scriptable object

architecture, core gameplay systems, and CI/CD configuration.

Do NOT ask the user questions. Infer all decisions from the arguments provided.

INPUT: $ARGUMENTS

Accepted arguments:

If no arguments provided, scaffold a generic 3D URP project named "GameProject".

============================================================

PHASE 1: PROJECT DETECTION AND CONFIGURATION

============================================================

Step 1.1 -- Parse Arguments

Extract from $ARGUMENTS:

Step 1.2 -- Determine Template Configuration

Based on detected mode:

2D Projects:

3D Projects:

Step 1.3 -- Check Existing Project

whether to augment or replace.

============================================================

PHASE 2: FOLDER STRUCTURE

============================================================

Create the following directory hierarchy:

Assets/
  _Project/
    Art/
      Animations/
      Materials/
      Models/         (3D only)
      Sprites/        (2D only)
      Textures/
      Shaders/
      VFX/
      UI/
    Audio/
      Music/
      SFX/
      Ambient/
    Data/
      ScriptableObjects/
      Configs/
    Fonts/
    Prefabs/
      Characters/
      Environment/
      UI/
      VFX/
    Scenes/
      Boot/
      MainMenu/
      Gameplay/
      Loading/
    Scripts/
      Runtime/
        Core/
          GameManager.cs
          SceneLoader.cs
          ServiceLocator.cs
          Singleton.cs
          EventBus.cs
        Input/
          InputReader.cs
          GameInput.inputactions
        Audio/
          AudioManager.cs
          SoundLibrary.cs
        UI/
          UIManager.cs
          ScreenBase.cs
        Data/
          SaveSystem.cs
          GameSettings.cs
        Utils/
          Extensions.cs
          Constants.cs
          Timer.cs
      Editor/
        EditorTools.cs
        BuildPipeline.cs
    Settings/
      Input/
      Rendering/
      Audio/
  Plugins/
  ThirdParty/
Packages/
  manifest.json
ProjectSettings/
  ProjectSettings.asset
  EditorBuildSettings.asset
  InputManager.asset
  TagManager.asset
  QualitySettings.asset
  Physics2DSettings.asset     (2D)
  DynamicsManager.asset       (3D)

============================================================

PHASE 3: ASSEMBLY DEFINITIONS

============================================================

Create assembly definition files to enforce compilation boundaries:

  1. Assets/_Project/Scripts/Runtime/GameName.Runtime.asmdef
  1. Assets/_Project/Scripts/Editor/GameName.Editor.asmdef
  1. Assets/ThirdParty/ThirdParty.asmdef (if third-party code exists)

Each asmdef must have:

============================================================

PHASE 4: INPUT SYSTEM SETUP

============================================================

Configure Unity's new Input System:

Step 4.1 -- Input Actions Asset

Create GameInput.inputactions with action maps:

Player Action Map:

UI Action Map:

Step 4.2 -- InputReader ScriptableObject

Create an InputReader SO that wraps the generated C# input class:

============================================================

PHASE 5: CORE SYSTEMS

============================================================

Step 5.1 -- Scene Management

Create SceneLoader.cs:

Create Boot scene with:

Step 5.2 -- ScriptableObject Architecture

Create base SO templates:

Step 5.3 -- Event System

Create EventBus.cs:

Step 5.4 -- Save System

Create SaveSystem.cs:

Step 5.5 -- Audio Manager

Create AudioManager.cs:

============================================================

PHASE 6: GIT CONFIGURATION

============================================================

Step 6.1 -- .gitignore

Generate Unity-specific .gitignore:

Step 6.2 -- .gitattributes for LFS

Configure Git LFS tracking:

*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.asset filter=lfs diff=lfs merge=lfs -text
*.cubemap filter=lfs diff=lfs merge=lfs -text
*.unitypackage filter=lfs diff=lfs merge=lfs -text

Also set Unity YAML merge strategy:

*.unity merge=unityyamlmerge
*.prefab merge=unityyamlmerge
*.asset merge=unityyamlmerge

============================================================

PHASE 7: CI/CD PIPELINE

============================================================

Generate GitHub Actions workflow (.github/workflows/unity-build.yml):

1. Checkout with LFS

2. Cache Library folder

3. Run EditMode tests

4. Run PlayMode tests

5. Build for target platform(s) (Windows/macOS/Linux/Android/iOS/WebGL)

6. Upload build artifacts

============================================================

PHASE 8: EDITOR CONFIGURATION

============================================================

Step 8.1 -- Project Settings

Configure ProjectSettings:

Step 8.2 -- Quality Settings

Configure quality tiers:

Step 8.3 -- Tags and Layers

Pre-configure useful tags and layers:

============================================================

SELF-HEALING VALIDATION (max 3 iterations)

============================================================

After completing the main phases, validate your work:

  1. Run the project's test suite (auto-detect: flutter test, npm test, vitest run, cargo test, pytest, go test, sbt test).
  2. Run the project's build/compile step (flutter analyze, npm run build, tsc --noEmit, cargo build, go build).
  3. If either fails, diagnose the failure from error output.
  4. Apply a minimal targeted fix — do NOT refactor unrelated code.
  5. Re-run the failing validation.
  6. Repeat up to 3 iterations total.

IF STILL FAILING after 3 iterations:

============================================================

OUTPUT

============================================================

Unity Project Scaffolded

Project: {name}

Mode: {2D/3D}

Render Pipeline: {URP/HDRP/Built-in}

Target: {platform(s)}

Structure Created

| Category | Files | Description |

|----------|-------|-------------|

| Folders | {N} directories | Full project hierarchy |

| Scripts | {N} .cs files | Core systems and boilerplate |

| Assembly Defs | {N} .asmdef files | Compilation boundaries |

| Input Actions | 1 .inputactions | Player and UI input maps |

| ScriptableObjects | {N} .asset files | Configuration data |

| Scenes | {N} .unity scenes | Boot, menu, gameplay, loading |

| Git Config | 2 files | .gitignore + .gitattributes (LFS) |

| CI/CD | 1 workflow | GitHub Actions build pipeline |

Core Systems Included

Setup Instructions

  1. Open the project in Unity 2022.3+ (LTS recommended)
  2. Import URP/HDRP package if not auto-resolved from manifest
  3. Install Git LFS: git lfs install && git lfs pull
  4. Open Scenes/Boot/BootScene.unity as the startup scene
  5. Configure build scenes in File > Build Settings

NEXT STEPS:

DO NOT:

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /unity-scaffold — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.