Hi everyone,
We are moving our project over from standard Unity audio, and I am wondering about how to best approach stationary ambience audio in our 3D world.
To give you an easy example, some of our trees have birdsong audio attached to them, so when a player walks into a forest, they hear a variety of birds and other animals from all directions around them. Before, we were achieving this by attaching audio sources and some of our own scripts, now I basically have 2 options:
-
attach a StudioEventEmitter, attach a collider, set the audio to start when the player enters the collider, and set it to stop when the player leaves the collider - with some custom scripts to make sure some of the audio starts halfway through, some other random noises are started if the player remains in the vicinity, etc.
-
use our existing scripts to start playing the audio with the set3Dattributes placing the point of origin in the tree, then rely on the max distance and attenuation to sort out when the player can hear the sounds. This may mean that there are a few hundred EventInstances in memory, and that they get instructions to play something new when the player is far beyond the max distance. On the other hand, we are avoiding the few hundred colliders and physics calculations that go with them.
Considering I don’t have too much insight on how effectively fmod handles the distances and attenuation, I’d love some thoughts on which of these approaches will likely be more performant - or if there is a third approach I haven’t thought of.
Thank you!