AudioSource.PlayClipAtPoint and pooling

Hi,

I noticed that AudioSource.PlayClipAtPoint creates ‘One shot audio’ object each time it’s called and it gets destroyed automatically.

I’m sure I can build a custom solution of pooling audio source prefabs that gets spawned at the location and get back into the pool after sound stops, but I wanted to ask if there’s any built-in way to pool that?

Thank you for advance.

Hi!

There is currently no built-in way to do this, but it’s a fun thing to implement :slight_smile:

Personally I like to have a “SoundEmitter” object that carries multiple AudioSources and enable/disabled them based on the need. You can keep a global emitter for all 2D sounds, which is where you get the best improvement. For 3D sounds it’s a bit less relevant in my opinion, unless you have a moving object with multiple sounds emitted at the same time.

1 Like