- Home /
Why do sounds cancel out other sounds?
I have a javascript where i hold the "w" key and a sound plays. But if i hold the "w" key and press another key, wich plays new sound, the new sound stops the other sound. Why is that?
Answer by Griffo · Oct 14, 2012 at 01:53 PM
Put the sound on a empty game object with audio source and just have it as child of your game object thats what I do to get multiple sounds to play at the same time.
You can have multiple audiosources on 1 object by adding them through code. If you don't need to spatialize the sources, it is the way to do it.
Answer by gregzo · Oct 14, 2012 at 01:38 PM
How do you trigger sounds? Based on what you're describing, you're doing something like this, I guess:
audio.clip = clip1;
audio.Play();
audio.clip = clip2;
audio.Play();
Where assigning clip2 to a source that is already playing a clip will stop that clip.
You could use PlayOneShot, or manage multiple audiosources yourself.
Your answer
Follow this Question
Related Questions
Cant Add Script (or create any new scripts) Javascript 2 Answers
Why do i get 4 errors here? (Javascript) 1 Answer
Audio Repeating. 1 Answer
Why are these errors messing with me? 2 Answers
syntax errors 1 Answer