- Home /
Multiple Sound Effects?
Is it at all possible for Unity to play multiple sound effects at the same time? I've set up 5 different audio sources and told which sound effect to play from yet whenever I'm playing one of them, the others will not play. Am I doing something wrong or is it actually impossible? If you can help, please leave an example script. Ex:
var AudioSource1 : AudioSource;
AudioSource1.PlayOneShot(FootSteps);
Answer by Jesse Anders · Apr 24, 2011 at 07:32 PM
Of course it's possible to play more than one sound at once. It's possible you've run into a bug or driver problem or something of that sort, but more than likely it's just a simple error in your code. (Without seeing the code though, it's hard to say what might be causing the problem.)
Could you tell me how to go about it? Because the above example is pretty much the audio portion of the code.
Hm, there's really not that much to say about it. If you have two AudioSource components, and you start playback on both audio sources (e.g. using Play(), PlayOneShot(), etc.), then both sounds should play at the same time. If that's not happening for you, then something is probably wrong somewhere (e.g. in your code or in your project setup).
What you posted looks fine, but it's not a complete example. To say for sure whether it would work, I think we'd need to see a complete script (or at least a complete code sample).
Your answer
Follow this Question
Related Questions
Multiple Audio Source Problem 1 Answer
Can I play multiple AudioSources from one gameobject? 8 Answers
Play back multi channel audio 0 Answers