unity
Installation
SKILL.md
Unity Guide
Applies to: Unity 2022 LTS+, C#, Games, VR/AR, Simulations, Interactive Media
Core Principles
- Component-Based Architecture: One MonoBehaviour = one responsibility
- Composition Over Inheritance: Combine components on GameObjects; avoid deep class hierarchies
- Data-Driven Design: Use ScriptableObjects for configuration and shared data
- Event-Driven Communication: Decouple systems with C# events, UnityEvents, or ScriptableObject events
- Cache Everything: Never call
Find,GetComponent, or allocate inUpdate
Guardrails
MonoBehaviour Rules
- Keep
Update()bodies under 20 lines; delegate to focused methods - Cache all
GetComponentresults inAwake()(never call inUpdate) - Subscribe to events in
OnEnable, unsubscribe inOnDisable
Related skills