unity-coding

Generate Unity C# code with namespaces, asmdefs, and editor/runtime separation.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/BreakerOfStems/claude-skills --skill unity-coding
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-coding
Source: https://github.com/BreakerOfStems/claude-skills/tree/main/skills/unity-coding
Command: npx skills add https://github.com/BreakerOfStems/claude-skills --skill unity-coding

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write Unity C# code that adheres to best practices, ensuring it functions correctly in both the Unity Editor and headless/server environments.

Core Features & Use Cases

  • Namespace Adherence: Enforces namespaces that match the folder structure for better organization.
  • Assembly Definitions (asmdef): Guides the creation of asmdef files to optimize compile times and manage dependencies.
  • Editor vs. Runtime Code Separation: Differentiates between code meant for the Editor and code for runtime, preventing common errors.
  • Headless-Friendly Code: Provides patterns to avoid issues in headless builds (e.g., null checks for Camera.main).
  • ScriptableObjects vs. MonoBehaviours: Advises on the appropriate use of ScriptableObjects for data and MonoBehaviours for scene-specific behavior.
  • Deterministic Server Code: Offers guidance on writing server-authoritative code using FixedUpdate and seeded random numbers.

Quick Start

Implement gameplay and system code changes following Unity conventions and best practices.

Frequently Asked Questions about unity-coding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Unity C# namespaces and assembly definitions for large projects?

To structure Unity C# namespaces properly, enforce namespaces matching your folder layout and utilize assembly definitions (asmdef) to manage dependencies and optimize compile times.

What is the best way to separate Unity editor code from runtime code?

The best way to separate Unity editor code from runtime code is to differentiate scripts meant for the Editor environment into distinct assemblies, preventing common build errors and ensuring clean runtime execution.

How do I write headless-friendly Unity C# code for server builds?

To write headless-friendly Unity C# code for server builds, implement patterns that avoid client-side dependencies, such as adding null checks for Camera.main, ensuring functionality without rendering graphics.

When should I use ScriptableObjects versus MonoBehaviours in Unity?

You should use ScriptableObjects in Unity for defining data and configuration, while MonoBehaviours should be reserved for handling scene-specific behavior and component-based gameplay logic interactions.

How do I write deterministic server code in Unity using C#?

To write deterministic server code in Unity, implement server-authoritative logic within FixedUpdate and utilize seeded random numbers to ensure consistent and predictable simulation outcomes across clients.