Back to Rules
C#

C# Unity Game Development Best Practices: Essential Rules for Scalable Games

Claude Directory November 29, 2025
1 copies 1 downloads

Unlock expert guidelines for C# scripting in Unity game development. Optimize performance, ensure modularity, and follow proven best practices for building maintainable, high-performance games.

Rule Content
Elevate your Unity projects with these rewritten, actionable rules for C# game development, emphasizing modularity, efficiency, and Unity's native tools.

### Fundamental Guidelines
- Deliver precise, code-focused answers featuring practical C# snippets and Unity integrations.
- Maximize Unity's core systems like physics, input, and UI to harness optimal performance.
- Emphasize code clarity, maintainability, and adherence to C# standards plus Unity conventions.
  - Employ PascalCase for public elements and camelCase for private ones.
  - Choose meaningful names for variables, methods, and classes.
- Organize projects modularly via Unity's component model for better reusability and isolation.

### Core C# and Unity Scripting Practices
- Attach MonoBehaviour scripts to GameObjects for behavior; opt for ScriptableObjects to manage data and assets.
- Rely on Unity's physics and collision systems for interactions and mechanics.
- Handle inputs via the new Input System for cross-platform compatibility.
- Build interfaces with Canvas and UI Toolkit elements.
- Strictly apply the Component design pattern to separate logic cleanly.
- Manage async tasks and timing with Coroutines in Unity's main thread.

### Robust Error Management and Debugging
- Wrap risky operations like I/O or networking in try-catch for resilience.
- Log issues using Debug.Log, Debug.LogWarning, or Debug.LogError.
- Profile performance with Unity's Profiler and Frame Debugger.
- Add custom debug visuals and messages for faster iteration.
- Validate logic early with Debug.Assert during builds.

### Required Dependencies
- Unity Engine as the foundation.
- Compatible .NET version per your Unity build.
- Select Asset Store packages sparingly for targeted features.
- Vet third-party assets rigorously for stability and speed.

### Unity-Centric Development Tips
- Instantiate reusable elements as Prefabs for GameObjects and UI.
- Confine logic to scripts; handle setup and scenes in the Editor.
- Animate with Animator Controllers and Animation Clips.
- Enhance visuals using built-in lights and post-processing stacks.
- Test thoroughly with Unity's unit and integration frameworks.
- Streamline assets via AssetBundles for dynamic loading.
- Categorize objects with Tags and Layers for efficient collisions.

### Performance Tuning Strategies
- Implement object pooling to reuse instances and cut GC pressure.
- Reduce draw calls through material batching and texture atlases.
- Deploy LOD groups on detailed 3D assets for smoother rendering.
- Accelerate compute tasks with the Job System and Burst Compiler.
- Refine physics by using proxy colliders and tweaking timestep settings.

### Essential Project Conventions
- Build around Unity's component architecture for flexibility.
- Prioritize optimization and memory efficiency from the start.
- Maintain organized folder structures for assets and scripts.

Comments

More Rules

View all
AI/ML

GLM-4.7 Optimized Config & System Prompt Designer

Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.

C
Community
AI/ML

GLM-4.7 Open-Source Coding Expert: Optimized System Prompt

Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.

C
Community
AI/ML

GLM-4.7 Optimized Coding Agent

This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.

C
Community
DevOps

Agentic Dev Loop: Autonomous Jira-Driven Coding Agent with GitHub CI Self-Healing

Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.

C
Claude Directory
AI/ML

Türk Hukuku Uzmanı AI Agent: Güvenilir Yasal Danışman System Prompt

Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.

C
Community
Database

PostgreSQL Best Practices: Expert Subagent Guide

Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.

C
Claude Directory