- Home /
240 Audio Sources, 1 audio source performance suggestion?
im making a game and i was wondering the best way to do something with audio, i am making a mobile app, i have 240 gameobjects and the max of them being active at once is 60-80, now i am going to put audio sources in for sound effects, i was wondering if i put an audio source on each game object if that will effect performance or if i should make an empty game object filled with about 10 other game objects that i can give a Vector3() and make the effect play cycling through the 10 game objects, does it really make a difference, those are the 2 options ive come up with so far, im really trying to push this engine to the limit for mobile and i am trying to really conserve on performance where i can. thank you for your time
Are they 240 unique sounds, or are they all like 'footsteps'? Hearing that many of anything at one time would be awful, and most sound cards only play up to 64 at a time anyway. $$anonymous$$obile probably much less.
its 15 sounds, randomly selected, and only played once at different times
Answer by DaveA · Sep 12, 2013 at 09:23 PM
I would just put one audio source on each one, have a script that picks the clip randomly at random times, make it a prefab, and put them in. See how it goes. And audio source object itself is not a big memory hog nor inherently cpu hog. It's how many clips are running at the same time (in audible distance) that might affect anything. If that does become an issue, set their max audio distance smaller.
Your answer
Follow this Question
Related Questions
Can I play multiple AudioSources from one gameobject? 8 Answers
performance between disable renderer and disable gameObject 2 Answers
Are .gameObject and .transform both using GetComponent() in the background? 1 Answer
Using Empty GameObjects to organize hierarchy? 2 Answers
Calling gameobject.transform vs. just calling transform directly - Performance negligible? 1 Answer