- Home /
How can I play a sound effect many times without cutting the last sound effect?
I am trying to make an air strike with explosion sounds. However, every time a new explosion starts the sound playing from the previous explosion gets cut off as if the sounds cannot be played over each other at the same time. I have tried googling, and there might be an answer to this already, but I have not found it. :\
Thanks in advance! Jay Tee.
Answer by tanoshimi · Nov 18, 2016 at 08:13 AM
An audiosource can only play one clip at a time. So if you want multiple clips to play at once, you need multiple audiosources.
A common solution is to have a pool of audiosource components and, when a request to play a clip is made, grab the first unused source from the pool (by testing if isPlaying is true). When the clip ends, return the source to the pool to be used again, just like any other object-pooling system.
Your answer
Follow this Question
Related Questions
Can not play a disabled audio source 2 Answers
Problem with playing sound on Trigger-Enter 2 Answers
How to instantly play an AudioSource 0 Answers
Boolean and audio is not working right 1 Answer
How to play music/audio 2 Answers