Loading lessons...
Memory Profiler & Project Auditor
Memory Profiler & Project Auditor
To diagnose memory leaks and find project-wide optimization opportunities, Unity provides the Memory Profiler package and the Project Auditor static analysis tool.
Memory Profiler Package
The Memory Profiler package provides a detailed breakdown of native and managed memory allocations:
- Snapshots: Capture a memory snapshot during gameplay to inspect every loaded Texture, Mesh, Audio Clip, and Script class instance.
- Comparing Snapshots: Capture a snapshot at Scene 1, load Scene 2, return to Scene 1, and capture a second snapshot. Comparing the two lets you see which assets failed to unload (indicating a memory leak).
- Managed Memory vs Native Memory: Track C# garbage collector handles vs native memory (textures, audio buffers, meshes).
Project Auditor
Project Auditor is a static analysis tool that scans your entire project for configuration and scripting problems:
- It runs inside the Editor and analyzes code syntax, compiler setups, asset size distribution, and project settings.
- It highlights problematic API calls (such as calling
FindObjectOfTypeinside anUpdateloop), uncompressed textures, and missing assembly definitions.
TL;DR
- Memory Profiler captures snapshots to track loaded assets and find leaks.
- Compare two snapshots to find objects that remain in RAM after scene changes.
- Project Auditor statically scans the project for suboptimal C# scripts and settings.
- Use auditor results to fix expensive API calls and optimize asset configurations.