- Home /
How to make Audio "Range" Further.
I'm making a FPS, Adding Cars. Everything is working except when the sound controller for the car created a gameobject called audio it does this.
AudioSource CreateAudioSource (AudioClip clip) {
GameObject go = new GameObject("audio");
go.transform.parent = transform;
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.AddComponent(typeof(AudioSource));
go.audio.clip = clip;
go.audio.loop = true;
go.audio.volume = 0;
go.audio.Play();
return go.audio;
}
and this here where the vehicle Camera is the engine is quiet. Is there is a way to add a peice of code to increase the range of the audo like you do in the scene by dragging the "Points" to increase the range. Please help me :)
This is written in C#.
Answer by Professor Snake · Feb 19, 2013 at 02:59 AM
You can modify go.audio.maxDistance and go.audio.minDistance to your liking. They are the maximum distance at which the sound will be heard, and the distance at which the sound will start fading respectively
Thank you!!! Wooot Now Zoom Closer-Further Allows the volume to be more "Perfect" Thank you.
Answer by $$anonymous$$ · Feb 19, 2013 at 03:01 AM
Unity has an easy built in logarithmic rolloff function for audio: link for the max distance and min distance
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to create sound on keyboard button? 1 Answer
What's wrong with this "menu" script? 1 Answer
Distribute terrain in zones 3 Answers
Play audio from directory? 0 Answers