- Home /
How do I set a distance for audioSource ???
Hello
How do I set a distance for audioSource ???
thx >>>
by set a distance do you mean that the sound should play only when sound source is within some distance?
Answer by aldonaletto · Jan 05, 2012 at 01:51 AM
You don't need any script to do that: in the AudioSource, select Rolloff Mode = Linear Rolloff, Max Distance = 5, Min Distance = 4.5 (or other value a little lower than the Max Distance) - this will make the sound disappear when the distance to the audio source is 5 or greater.
how this distance gets calculated? Based on camera position.
Answer by Enyph-Games · May 21, 2016 at 03:49 PM
If you are using Unity 5, find 3D Sound Settings at the bottom of the Audio Source component, expand it, and then find Max Distance and set it to whatever value you want.