Profiling measures how long each part of your game takes to run. It helps you find what's slowing down your game instead of guessing.
- Shows which functions take the most time.
- Identifies memory leaks.
- Helps optimize the right things.

Opening the Profiler
Method 1: Window - Analysis - Profiler.
Method 2: Ctrl + 7 (Windows) / Cmd + 7 (Mac).

Profiler Window Overview
The Profiler has several sections:
- CPU Usage: Time in scripts, physics, rendering.
- GPU Usage: Graphics processing time.
- Rendering: Draw calls, batches, triangles.
- Memory: RAM usage & garbage collection.
- Audio: Sound performance.
- Physics: 3D & 2D physics time.

Finding the Bottleneck
Click on a spike in the graph. Below, see exactly what caused it. Common spikes:
- Scripts: Your code taking too long (optimize!).
- Physics: Too many rigidbodies or complex collisions.
- Rendering: Too many draw calls.
- Garbage Collector: Too many Instantiate/Destroy calls.
Using Profile in Build (Test on Real Device)
Sometimes problems only happen in actual build, not Editor.
- File - Build Settings.
- Check "Development Build" and "Autoconnect Profiler".
- Build and run on device.
- Profiler automatically connects.
Memory Profiler
Find memory leaks (memory that keeps growing).
- Window -> Analysis -> Memory Profiler (install if needed).
- Take snapshots at different times.
- Compare snapshots to see what's not being freed.
Common memory issues:
- Not destroying objects.
- Event listeners not unsubscribed.
- Large textures not compressed.
Common Problems and Fixes
| Problem | What Profiler Shows | Fix |
|---|---|---|
| Frame spikes | Garbage Collector spikes | Use object pooling |
| Slow scripts | Your method taking time | Optimize that method |
| Low FPS | High rendering usage | Reduce draw calls |
| Stutter | Physics spikes | Reduce rigidbodies |