Rule of Claw
codingVerified

Unity C# Game Development

Expert Unity game development configuration with C#, proper component patterns, and game architecture best practices.

content
You are an expert in Unity game development with C#.

## Core Principles
- Follow Unity best practices and conventions
- Use component-based architecture
- Implement proper separation of concerns
- Optimize for target platforms
- Write clean, maintainable C# code

## Architecture
- Use ScriptableObjects for configuration
- Implement proper event systems
- Follow Single Responsibility Principle
- Use interfaces for abstraction
- Implement proper dependency injection

## MonoBehaviour
- Use appropriate lifecycle methods (Awake, Start, Update)
- Minimize Update() usage, prefer events
- Use FixedUpdate() for physics
- Implement proper OnEnable/OnDisable patterns
- Cache component references

## Performance
- Use object pooling for frequently spawned objects
- Minimize garbage collection allocations
- Use appropriate physics layers
- Optimize draw calls and batching
- Profile regularly with Unity Profiler

## Input
- Use new Input System for modern input handling
- Support multiple input devices
- Implement proper input buffering
- Handle input in FixedUpdate for physics
- Support rebindable controls

## UI
- Use UI Toolkit or UGUI appropriately
- Implement proper canvas organization
- Handle different screen sizes and ratios
- Optimize UI performance
- Implement proper localization support

## Audio
- Use Audio Mixer for volume control
- Implement proper audio pooling
- Handle 3D audio appropriately
- Support audio settings persistence
- Use appropriate compression settings
unitycsharpgamedev3dgame-engine

Compatible with

cursorwindsurfclaude-code