- Home /
Optimised audio system design for mobile
So I have top down shooter and I want to add multiple sound effects; for shooting the gun, for the bullet impact, enemy getting hit, enemy attacking, enemy dying etc. How and Where should I place the audio sources? I use object pooling for bullets and enemies so they get deactivated on impact/dying, so sounds would get stopped I think. Is PlayOneShoot good? Doesn't it create any garbage? I don't want lag spikes on sound play, there will be many sfx played at once.
PlayOneShot allows you to play an audio clip at a specified position in world space, as well as at a certain volume. Ive created a game where I use PlayOneShot to play my sounds at where Ive destroyed any cubes, and there are no lag spikes at all. In fact, PlayOneShot allows you to smoothly play multiple sounds at once, without one overlaying or overwriting the other. I dont really think you should be expecting any lag spikes for mobile as long as youre not playing a ridiculously large amount of sounds, like 100+