- Home /
constant audio sounds?
i have a large game object and i need to add continues sounds to it . and engine sound , and another sound at the other end. they both uses differnt pictchs
obviously i cant use oneshot, and thats all i have used up untill now
how do i set this up via script ?
Answer by Griffo · Oct 31, 2012 at 03:08 PM
What I'd do is add empty game objects to the scene and child them to your large game object positioning them on the large game object where you want the sound to play from then add a script and sound source to each empty game object, drop the sound file on to it then put something like below.
var engineSound : AudioClip;
function Update(){
}
function EngineSound(){
audio.volume = 1.0;
if (!audio.isPlaying){
audio.clip = engineSound;
audio.pitch = Random.Range(0.8f, 1.0f);
audio.Play();
}
}
Your answer
Follow this Question
Related Questions
How to use Mathf.SmoothDamp for audio ? 1 Answer
AudioSource pitch measurement unit 1 Answer
GetSpectrumData works only for 3 sec of microphone input 0 Answers
getting pitch 1 Answer
How to i make a gear system from this script? help please 1 Answer