unity-performance
Optimize Unity game performance through profiling, draw call reduction, and resource management. Masters batching, LOD, occlusion culling, and mobile optimization. Use for performance bottlenecks, frame rate issues, or optimization strategies.
$ Installer
git clone https://github.com/creator-hian/claude-code-plugins /tmp/claude-code-plugins && cp -r /tmp/claude-code-plugins/unity-plugin/skills/unity-performance ~/.claude/skills/claude-code-plugins// tip: Run this command in your terminal to install the skill
name: unity-performance description: Optimize Unity game performance through profiling, draw call reduction, and resource management. Masters batching, LOD, occlusion culling, and mobile optimization. Use for performance bottlenecks, frame rate issues, or optimization strategies. requires:
- csharp-plugin:csharp-code-style
Unity Performance Optimization
Overview
Performance optimization for Unity games focusing on profiling and systematic optimization.
Foundation Required: unity-csharp-fundamentals (TryGetComponent, FindAnyObjectByType, null-safe coding)
Core Topics:
- Unity Profiler analysis
- Draw call reduction
- GPU instancing and SRP Batcher
- LOD (Level of Detail)
- Occlusion culling
- Object pooling
- Memory optimization
Quick Start
Collection & Object Pooling
GC-free pooling is critical for performance. Use Unity's built-in UnityEngine.Pool namespace (2021.1+):
using UnityEngine.Pool;
// Temporary collection pooling - eliminates GC spikes
List<Enemy> enemies;
using (ListPool<Enemy>.Get(out enemies))
{
GetComponentsInChildren(enemies);
ProcessEnemies(enemies);
} // Auto-released
See
unity-collection-poolskill for comprehensive patterns:
- ListPool, HashSetPool, DictionaryPool for temporary collections
- ObjectPool for component/prefab pooling
- Advanced patterns: Keyed pools, auto-return, ECS integration
Performance Targets
- Mobile: 30-60 FPS, <100 draw calls
- Desktop: 60+ FPS, <500 draw calls
- VR: 90 FPS minimum, <200 draw calls
Profiling Workflow
- Profile first: Identify actual bottleneck (CPU/GPU/Memory)
- Measure baseline: Record before optimization
- Optimize bottleneck: Focus on biggest impact
- Measure improvement: Validate changes
- Repeat: Until target performance reached
Optimization Checklist
CPU Optimization
- âś… Reduce Update/FixedUpdate calls
- âś… Object pooling for frequently spawned objects
- âś… Cache component references in Awake/Start
- âś… Use events instead of polling
GPU Optimization
- âś… Static batching for static objects
- âś… GPU instancing for identical meshes
- âś… Reduce SetPass calls via material sharing
- âś… LOD groups for distant objects
- âś… Occlusion culling for large scenes
Memory Optimization
- âś… Texture compression
- âś… Mesh optimization (reduce vertex count)
- âś… Audio compression and streaming
- âś… Asset bundle management
- âś… Unload unused assets
- âś… Collection pooling (see
unity-collection-poolskill)
Related Skills
- unity-collection-pool: GC-free collection management with ListPool, HashSetPool, DictionaryPool, and ObjectPool. Essential for eliminating GC spikes.
Best Practices
- Profile on target platform: Editor performance differs
- Optimize systematically: Measure, optimize, validate
- Quality settings: Provide options for different hardware
- Balance visuals vs performance: Adjust based on target
- Test on low-end: Ensure minimum spec performance
Repository
