- Home /
Too many audio sources
Hi, I'm working on a 2D game with more than 50 gameObjects on scene with audio sources. When an object shoots is should play shoot sound, but because of many objects its just crazy when everyone shoots. Any suggestion how to fix it?
Answer by AlwaysSunny · Mar 30, 2015 at 08:20 PM
Proper approach:
Write an audio manager singleton. Request sounds from the audio manager. The manager keeps a collection of logically-grouped AudioSources in the scene. The manager can reject play requests if too many concurrent sounds in the same group (gunfire, vocals, foleys) are already playing.
Easy approach:
Keep a collection of gunfire audio sources; reject play requests if too many concurrent instances are playing.
Your answer
Follow this Question
Related Questions
User Audio input and line in audio 0 Answers
Loading music for initial scene loading takes a very long time 1 Answer
movie audio not functioning 0 Answers
Audiosurf style audio analysis (unity 3.5) 3 Answers
Audio Priority problems... 0 Answers