- Home /
WWW Audio and PlayOneShot: Playing the same AudioClip Twice Cuts off First Instance
We want our users to be able to add their own sounds to the game. Right now I'm preloading all audio using the WWW class because from what I understand, streaming audio is not working currently under the latest build of Unity.
From what I understand PlayOneShot creates a new AudioSource and handles all the clean up once the clip is done. The sounds layer with each other perfectly, as long as each AudioSource instance is playing a different clip.
However, if I try to play the same medium length clip twice, I can hear that the first clip is stopped prematurely. I've tried everything I can think of:
I've tried to instantiate a new audioclip but it returns an empty clip. I've Manually created another AudioSource and used Play(), but it cuts off as well.
Unity answers has a question with the same problem but with no working answer: http://answers.unity3d.com/questions...udio-clip.html
I've had no issues with multiple copies of the same clip when using files directly out of the library. It seems that this problem could be directly related to WWW. Any help would be greatly appreciated.
Answer by Jack Trades · Oct 26, 2011 at 01:49 PM
Using www.GetAudioClip( true/false , true), solves this issue. Setting second attribute makes this sound streaming which make it possible to overlap AudioClips.
Your answer
Follow this Question
Related Questions
Sound wont play when triggered (javascript) 1 Answer
Why PlayOneShot is not working? C# 1 Answer
How do i stream music from a server? 0 Answers
Get AudioClip from Path?,How to get AudioClip from a path? 1 Answer
Need help with AudioSources 1 Answer