How to play an ambient sound effect

This continues from where we left off with How to create your first Sound Effect with Variations. Make sure you've done those steps first.

An Ambient Sound will play only when it is within audible range of the Audio Listener, and stop playing when out of range. Read more on the Ambient Sound page.

     
  1. Ambient Sound 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.
  2.  
  3. Create or locate a game object in your Scene that is positioned where you'd like an ambient sound effect to play from.
  4.  
  5. Add the Ambient Sound component to the game object from the menu: Component -> Dark Tonic -> Master Audio -> Ambient Sound
     
  6.  
  7. Go ahead and choose the Sound Group you want to play from the Ambient Sound Group dropdown.
  8.  
  9. If this is a Game Object that ever moves, check the "Follow Caller" box. The chosen Sound Group will now play whenever the caller is in hearing range, and it will stop playing when out of range. For more details on how this works, read the Ambient Sound page.
  10.  
  11. If this is a Game Object that is long or irregularly shaped, check the "Use Closest Collider Position" box. This will make sure that the Audio Source is always positioned at the closest part of the collider to the Audio Listener. This is good for rivers or anything with a mesh collider, and much more. Note that you will need to check "Use Top Collider" or the other checkbox under that that appears under this to tell Master Audio what collider(s) to use.
 
Continue with the next Quick Start, How to play a sound effect from a collision!