I can't find any information about Unity's performance difference between 3D and 2D audio.
If I'm targeting low-performance mobile devices, should I avoid using 3D audio?
How expensive (performance overhead) is 3D audio compared to 2D?
I can't find any information about Unity's performance difference between 3D and 2D audio.
If I'm targeting low-performance mobile devices, should I avoid using 3D audio?
How expensive (performance overhead) is 3D audio compared to 2D?
I have optimised and shipped 6 mobile games in Unity and have never had to do any audio optimisations. (Except changing music tracks to be streaming instead of decompress on load, and tweaking audio import settings for load time/memory improvements)
I can almost guarantee that your performance problems will be elsewhere, and worrying about something like audio with no indications that it's going to be a performance issue is likely going to distract your attention from other things that are more likely to be performance issues, eg scripts, garbage collection, draw calls, shaders, etc.
However, I would consider if positional audio is even a good idea for a mobile game. Many players may mute sound entirely. Does knowing where a sound comes from actually help the game, or does it just make the audio harder to distinguish?
I would say that using 2D vs 3D audio will make basically no difference, it's unlikely Unity would have some kind of check to skip some processing if an audio source is only 2D, as the savings would be extremely miniscule. (A distance check to calculate volume falloff is very simple and easily optimizable and cache-able, so it's likely highly optimised by Unity/Fmod anyway)
Audio optimisation techniques involve practices that are often shared among different engines. Many concepts and terms are standard in the audio domain, such as listeners, files, clips, and sources.
Unity's audio profiler is your to-go tool when searching for performance bottlenecks and issues you can't see (well, hear) when playing. It shows you how many audio sources are in your scene, different CPU consumption percentages per task, memory usage. These depend on the audio settings for your project, which you define according to what devices you're targeting.
Simple 3D audio is just audio where panning and volume depend on the direction and distance from the listener respectively. Unity does this automatically, letting you define additional parameters on a per-Audio Source basis:
A logarithmic roll-off curve behaves differently from a linear roll-off curve: the former is more realistic, but the latter is less expensive to compute (especially if you have many sounds playing at once). All these computations are done by the CPU. While low-end devices are okay with rendering some 3D audio, overloading them with unnecessary instructions is definitely not what you want.
You can use 3D audio on low-end devices, as long as there isn't too much work for the processor. You can:
And use the Audio Profiler to check for possible bottlenecks in your audio performance. 3D audio works fine if there aren't too many audio files to stream/store in memory.