Sound from Group
Playback methods for individual sounds inside a collection, registered in the Audio Manager.
What is a Sound from Group?
A SoundFromGroup is a reference to one specific sound inside an AudioCollection. It gives you direct access to a single clip while keeping the parent group organized in the Audio Manager. If you are unsure what an AudioCollection is, see the Audio Collection page.
Use it when you know exactly which sound within a collection you need — a named footstep variant, a specific UI click inside a larger pack, or a particular voice line. Each reference controls only that one clip and does not affect other sounds in the collection.
Creating a Sound from Group
You need a SoundFromGroup reference before calling any playback method. There are two ways to get one:
Inspector assignment
Declare a field on your script and assign the sound from the Unity Inspector. See Inspector Assignment for the full walkthrough.
Get function
Look up the sound by collection and sound name at runtime with GetSoundFromGroup. This is useful when names come from data or the same script handles multiple entities. See Get Functions for details on all lookup methods.
API Reference
Once you have a reference, use the methods below to control playback.
Play
Starts playback using the default volume and pitch you set for this sound in the Audio Manager window. Restarts from the beginning if the sound is already playing.
Play (volume, pitch)
Starts playback with explicit volume and pitch values. volume is typically between 0f (silent) and 1f (full). pitch uses 1f as the normal playback speed — lower values sound deeper and slower, higher values sound sharper and faster.
Example
PlayRandomPitch
Plays the sound once with a pitch randomly chosen between minPitch and maxPitch on each call. This adds natural variation so repeated sounds — footsteps, gunfire, UI taps — feel less mechanical without needing separate clips.
Example
Stop
Stops playback immediately and clears any active fade or pause. For a smooth ending, use FadeOut() instead.
FadeIn
Raises volume from the current level to targetVolume over duration seconds.
Example
FadeOut
Lowers volume to silence over duration seconds, then stops playback. Unlike Stop(), the sound winds down instead of cutting off abruptly.
Example
Pause
Holds playback at the current position. The clip stays paused until you call Resume() or Stop().
Resume
Continues from where Pause() left off. Has no effect if the sound was not paused — use Play() to restart from the beginning.
Common Use Cases
For practical examples — named collection entries, targeted effects, and more — see the Common Use Cases page.