I have one looping sound in the background, triggered from script with audio.Play();
Sometimes other sounds are played on top of that with audio.PlayOneShot(myClip);
Now almost every time this accurs the loop stops after a short while. But only on the iPhone - never in the Editor…
These are all WAV and uncompressed and all on the same AudioSource. Should I split it to use 2 AudioSources? Any idea what’s wrong? Any help or input would be very much appreciated!
Try experimenting with different uncompressed formats (for example I remember people complaining about mono sounds and glitches on Apple devforums - Apple Developer Forums), maybe splitting sounds could help too.
In general Unity plays uncompressed sounds directly via OpenAL and not much else is happening.
hm… I now added a GUI-Label that shows all the properties of the AudioSource. Everything still runs fine in the editor, but on the iPhone every so often one of the 3 clips (that are played alternately in the background) just isn’t there.
audio.isPlaying shows false and audio.time is at 0.
the weird thing is that it changes mid-game. once file0 + file2 and file1 isn’t playing, then after a bit file2 and file1 work, yet file0 isn’t playing… it seems to be random…
could this be a problem with loading a file into the AudioSource?
I have all the AudioClips in an BuiltIn Array btw and change them using audio.clip = snd[×]; audio.Play();
Would it be worth a try to have multiple AudioSources and Start/Stop them instead of changing the audio.clip?
PS: If I never switch and just play the same file forever on, there’s no problem…