Dull all sounds except one

Hi! I’m looking for a way to decrease volume of all sounds except one in my scene by proximity to an object, while increasing the volume of the exception sound. I tried using the microphone settings, but then I can’t hear the sound I’m looking to make louder.
Any ideas how this could be achieved?
Thanks!

Hi.
First find all your sound objects and add them to an array for reference.

quick search: http://answers.unity3d.com/questions/304182/controlling-all-sounds-from-their-volume-point.html

var sounds : AudioSource[] = FindObjectsOfType(AudioSource) as AudioSource[];

Then find distance from said object to other(I don’t know to what, your question was not clear).
http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Distance.html

Then, in loop adjust volume of other sounds in the array. Increase volume of chosen sound by lerp distance.
Oh, and figure out how to distinguish chosen sound from the others :slight_smile:


foreach (AudioSource s in (AudioSource[])findSceneObjectsOfType(typeof(AudioSource)))
    if (!ReferenceEquals(s, theOneYouDontWantToDull))
        s.volume = 0.1f; //or whatever you want to set it to