Course contentsShow
← Unity Game Development
Lesson 358 of 8285. UI and Audio SystemsFree lesson

Debugging Spatial Audio with Audio Profiler

Use the Unity Audio Profiler to visualize and troubleshoot sound attenuation, occlusion states, and memory usage within your immersive audio environment.

In this lesson, you will learn how to use the Unity Audio Profiler to visualize sound behavior and identify common spatialization issues in real-time.

When you’re building an immersive 3D environment, it is often difficult to tell why a sound is too quiet, why it isn’t fading correctly, or why a wall isn’t properly occluding an audio source. The Audio Profiler acts as your "x-ray vision" for the sound engine, allowing you to see the actual math happening behind the scenes.

Accessing the Profiler

To get started, open Window > Analysis > Profiler. Once open, ensure the Audio module is active by clicking the "Module" dropdown at the top and checking "Audio." When you play your scene, you will see a real-time graph of your audio performance.

Troubleshooting Spatialization

The most powerful feature for spatial debugging is the Audio Profiler window’s "Channels" view. When you click on your AudioSource while the game is running, you can inspect:

  • Attenuation: Look at the "Distance" parameter. If your sound isn't playing as expected, check if the distance attenuation curve is dropping off too quickly. The profiler shows you the exact decibel level calculated for the listener's distance.
  • Occlusion & Obstruction: If you have implemented AudioReverbZones or geometry-based occlusion, the profiler will show the signal path metrics. If an object is blocking the sound, the profiler will highlight the attenuation offset caused by your obstruction settings.
  • Voice Usage: If you have too many sounds playing at once, the "Voices" column will show you if sounds are being stolen (cut off) due to reaching your project’s maximum voice limit.

For example, if you notice a sound is inconsistent, check the profiler during gameplay:

// Use this to check if a specific source is active
Debug.Log($"Source {myAudioSource.name} is playing: {myAudioSource.isPlaying}");

While this code tells you if it's playing, the Profiler tells you how it's playing—showing you if the signal is being processed through your AudioMixer groups or being attenuated by a distance curve you may have accidentally misconfigured.

Key Takeaway: The Audio Profiler is your primary tool for validating that your spatial settings—like rolloff curves and occlusion—are correctly affecting audio signal levels in real-time.