---
description: Unity Dev Expert Overview
alwaysApply: false
---

# Unity Dev Expert Overview

Principal-level guidelines for Unity game development covering architecture, performance, and cross-platform delivery.

## Scope

- C# scripting architecture and MonoBehaviour lifecycle
- ECS/DOTS for high-performance scenarios
- Physics simulation, collision detection, raycasting
- Shader programming (Shader Graph, HLSL, URP, HDRP)
- UI development (UI Toolkit, UGUI)
- Multiplayer networking (Netcode for GameObjects)
- Performance profiling, memory management, optimization
- Asset pipeline, Addressables, platform builds

## Core Principles

- **Composition Over Inheritance**: MonoBehaviours are components, not base classes. Combine small, focused components.
- **Data-Oriented Mindset**: Think data layout, cache coherence, batch processing. ECS/DOTS formalizes this.
- **Profile Before Optimizing**: Use Unity Profiler on target device. Never guess bottlenecks.
- **Deterministic Lifecycle**: Know Awake/OnEnable/Start/Update/FixedUpdate/LateUpdate order. Init-order bugs are common.
- **Platform-Aware Design**: Frame budgets, input, memory, and rendering vary across mobile/console/VR/desktop.
- **Testable Architecture**: Separate logic from MonoBehaviour. Keep pure C# testable outside the engine.

## When to Use ECS vs MonoBehaviour

| Criteria | MonoBehaviour | ECS/DOTS |
|----------|---------------|----------|
| Entity count | <1,000 | 1,000-1,000,000+ |
| Team familiarity | Standard Unity | Requires DOTS training |
| Iteration speed | Fast prototyping | Slower initial setup |
| Performance ceiling | Moderate | Very high (Burst + Jobs) |
| Third-party assets | Full support | Limited |

## Key Technology Choices

| System | Primary | When to Consider Alternatives |
|--------|---------|-------------------------------|
| Input | Input System Package | Never use legacy Input |
| Asset Loading | Addressables | Avoid Resources.Load |
| UI | UI Toolkit (new) / UGUI (VR/world-space) | IMGUI for debug only |
| Networking | Netcode for GameObjects | Mirror/Photon for specific needs |
| Rendering | URP (most) / HDRP (high-end PC/console) | Built-in for legacy only |

## Common Pitfalls

**GC Allocations in Hot Paths**: Strings, LINQ, arrays in Update. Cache allocations, use StringBuilder.

**Ignoring Execution Order**: Assuming Start runs before another Awake. Use Script Execution Order or explicit init chains.

**Over-Networking**: Syncing particles and animations. Sync authoritative gameplay state; derive visuals locally.
