Ambient Sound
Note: This feature requires Physics3d to be installed in your project. Also, use the Welcome Window to enable Physics3d support in Master Audio if you haven't yet.
It accomplishes this by creating a trigger the size of the Audio Source's Max Distance that follows the caller's position. There's another trigger that follows the Audio Listener (also containing a non-gravity Rigidbody - necessary for the trigger to work) and whenever the 2 triggers hit each other, the sound plays. Whenever the 2 triggers leave each other, the sound stops. Coupled with the Occlusion feature, you can get very efficient and dynamic audio even with hundreds of ambient sounds spread throughout a large Scene.
- Ambient Sound Group: Here you choose the Sound Group that will play when the caller is within hearing range of the Audio Listener. Note that once you have selected a Sound Group, you will see a mesh sphere gizmo in Scene View showing you the Max Distance of the Audio Source of the selected Sound Group.
- Variation Mode: Choose either Play Random or Play Specific. If you choose the latter, you get a textbox where you can enter the name of the Variation you want to play.
-
Use Closest Collider Position: Check this box if you want to let the Audio Source always be positioned at the closest part of the collider(s). If this is checked, the Follow Caller option is disabled. Note that if you're using 2D colliders, it's the closest point on the collider bounds instead of the collider (which is square shaped). More settings appear once you check this box so you can specify which collider(s) to use:
- Use Top Collider: Check this box to use the Collider on the same Game Object.
- Use Child G.O. Colliders: Check this box to use the Colliders on all child nodes of this Game Object (only 1st level children).
- Follow Caller: Check this box if the caller will ever move, so that the sound will follow it also. If it's a stationary object, no need to check this, and you get slightly better performance.
- Runtime Follower: At runtime, this show up and you can click it to find the "follower" Game Object that contains the trigger used by Ambient Sound.
- Trigger Exit Behavior: This controls what happens when the Audio Source goes out of audible range. Normally, a fade is not needed unless you teleported over a large distance in a 3d game, or are using 2D sounds. Select Stop Sound (the default) or Fade Sound. If you choose the latter, you can specify the Fade Time in a field that appears beneath.
- Min / Max Distance: This control appears if you have a Sound Group selected and lets you change the Min & Max Distance of its Audio Sources. The mesh sphere gizmo in Scene view can be seen changing size as you tweak. Normally, if your distance from the Audio Listener to the Audio Source is between zero and the Min Distance, the sound will be heard at full volume, and it starts to get quieter as you approach the Max Distance.