/Unity-Audio-Pooling

Unity Audio Source Pooling

Primary LanguageC#The UnlicenseUnlicense

Unity Audio Pooling

SoundPooling

Take control of the sounds in your game by pooling your Audio Sources! Reduce the number of real voices required to play a multitude of audio clips, manage their lifecycle, and enhance performance. Learn how to streamline your audio management and make your game sound fantastic with efficient audio source pooling!

Example Usage

  1. Create a prefab with a SoundEmitter component for pooling.
  2. Add a SoundManager component to a new empty Game Object in your project.
  3. Add an Audio Mixer with at least one channel.
  4. Add a SoundData field with references to an AudioClip and an AudioMixerGroup
[SerializeField] SoundData soundData;

// Cache SoundBuilder for performance
SoundBuilder soundBuilder = SoundManager.Instance.CreateSoundBuilder();

soundBuilder
    .WithRandomPitch()
    .WithPosition(transform.position)
    .Play(soundData);
}

YouTube

You can also check out my YouTube channel for more Unity content.