- Home /
Multiple AudioSources overwriting a looping AudioSource
Hey all,
Having a problem with regards to AudioClips and Sources. Essentially, it seems like large numbers of AudioSources overwrite my looping music.
I run my level's music from a looping AudioSource which is pretty simple (at the moment it doesn't even have an attached script). The source has max priority (255) so shouldn't be overwritten by any of the other AudioSources in the scene.
These sources can get numerous though. In the scene I'm testing now, I have four spaceships, each with around 6-8 AudioSources each. Generally they won't all be playing at the same time. I'd estimate that I have a maximum of 16-20 sources playing at once, and the Listener shouldn't be in range of most of them. These sources all have priority 128. They generally play through PlayOneShot().
When playing the level, things start off OK, but eventually the music will get cut off or silenced - the other sounds still work perfectly though. It's getting rather vexing and I don't quite get what could be happening. There doesn't seem to be any real pattern to it other than it happens when a sound plays. Logging the state of the Music source indicates that it doesn't stop or anything.
Does anyone have any ideas? I'd think I might have run into a simultaneous source playing limit, but I haven't been able to find anything concrete (I also recall running a scene without music somewhat earlier with many more sources and no problems).
I should also mention that the AudioClips that are being played are mono sounds set to 3D sound, with the exception of some UI sounds that are mono and not 3D. The music AudioClip is 2 channel and not 3D.
In addition, I've now tried fiddling with the compression/load options for the clips to no real change. UI/Effect clips are compressed in memory, music is streamed from disk.
Your answer
Follow this Question
Related Questions
Help with IEnumerator and if sound is playing 2 Answers
OnTriggerExit stop audio 1 Answer
Instanced Prefabs: Audio clip array out of range 1 Answer
Multiple audiosources 1 Answer
AudioClip.Create crash on Mac OSX 1 Answer