- Home /
The performance is fine now, all I did was restart Unity
Poor performance when using AudioSource.Play
I have about 20 zombies in my game which constantly make a random groaning noise. I do this by choosing a random clip (Random.Range) from an array and if the audiosource on the zombie is not playing (source.isPlaying), I assign the random clip and play it(AudioSource.Play).
For some reason, this causes massive FPS drops. has anyone else noticed this? Is there a more efficient way to play sounds?
Is Random.Range expensive to run 20 times per update?
The zombies all have an audiosource with 3d sound, linear rolloff and a small distance (I think it's about 10).
The FPS drop is very significant from over 200fps to under 60. The profiler shows double the CPU usage while the sounds are playing.
Appreciate any advice.
Follow this Question
Related Questions
When is audio file loaded to memory 0 Answers
Random, 3d sound. 1 Answer
What is the most efficient way to play random audio tracks? 1 Answer
Random Footsteps within CollisionSoundEffects Script 1 Answer
Audio continuation through two scenes 3 Answers