How does AudioSource.priority work?

Some times when the profiler is reporting that there are ~22 AudioSources around, some sounds are still not heard.

I thought that there was a hard limit of 32 AudioSources, and that the 32 AudioSources with the lowest priority number would be heard. Some times when I have ~35 AudioSources, and I play sounds that have a low priority number, it’s still not heard (I was playing in the editor). I know that at least 8 AudioSources had higher priority numbers at that time.

These problems also vary from execution to execution. Some times it’s fixed by stopping and starting the game, then doing the exact actions as I previously did.
Some executions even have no sound at all. All I need to do to fix it is “turn it off and on again”.

Is there an effective way of debugging issues about missing sounds?


Priority should work as stated in the docs. But be careful to the following :
-AudioSource to AudioListener distance ( default logarithmic rolloff means a sound will quickly disappear with distance
-File type and import settings ( try decompressed in memory )
-Try a standalone build, as the editor sometimes is a bit buggy when it comes to audio

Easy way to Debug : Take a sound effect, chirp.wav for example.
chirp.wav is one second, pad it with 31 more seconds of silence.
Assign it to 32 AudioSources, set to loop.
Start to play each source 1 second after the previous.
If you have holes in playback, something’s amiss ( you should get one chirp per second ).