Search documentation

Search documentation pages and sections

Get it

Get Functions

Look up Unity Audio Manager sounds by name at runtime when Inspector assignment is not practical or your game needs dynamic audio access.

Overview

Get functions let you retrieve audio references from the Audio System using the names you defined in the Audio Manager window. Call them from any script during runtime to access AudioCollection, SingleSound, or SoundFromGroup instances without wiring them up in the Inspector.

If you would rather assign sounds visually in the editor, see the Inspector Assignment guide.

When to Use

Reach for Get functions when you need to resolve audio at runtime — for example, when sound names come from configuration files, when the same script handles multiple entities with different sounds, or when a component cannot expose Inspector fields.

For sounds that are fixed at design time — player jumps, menu clicks, level music — Inspector assignment is usually simpler. Both approaches return the same types and support the same playback methods, so you can mix them freely across your project.

Available Functions

All lookups go through AudioSystem. Pass the exact name shown in the Audio Manager window — names are case-sensitive.

GetAudioCollection

C#
AudioSystem.GetAudioCollection(string collectionName)

Returns an entire audio collection by name. Use this when you need to work with a group of related sounds — background music tracks, ambient loops, character voice lines, or any set you manage as a unit.

GetSingleSound

C#
AudioSystem.GetSingleSound(string soundName)

Returns a standalone sound by name. Ideal for one-off effects that exist outside a collection — button clicks, item pickups, UI feedback, and similar isolated clips.

GetSoundFromGroup

C#
AudioSystem.GetSoundFromGroup(string groupName, string soundName)

Returns one specific sound from within a named collection. Use this when you need direct access to a single entry inside a group while keeping the rest of the collection organized in the Audio Manager.

Example

The following retrieves each sound type by the names registered in the Audio Manager:

C#
AudioCollection musicCollection = AudioSystem.GetAudioCollection("BackgroundMusic");
SingleSound jumpSound = AudioSystem.GetSingleSound("PlayerJump");
SoundFromGroup footsteps = AudioSystem.GetSoundFromGroup("PlayerSounds", "Footsteps");

Once retrieved, use the returned object the same way you would an Inspector-assigned reference — call Play(), FadeIn(), or any other method available on that sound type.

Renaming Sounds

Get functions resolve sounds by the name stored in the Audio Manager. If you rename a collection or sound in the Audio System window, any code that passes the old name will no longer find it.

Update the string literals in your scripts to match the new name, or keep names stable throughout development. Inspector assignments are affected the same way — see Inspector Assignment for details.

Tip: consider centralizing sound names in constants or a static class so renames only need to happen in one place.

Sound Types

If you are unsure what AudioCollection, SingleSound, or SoundFromGroup are, see the Sound Types page for a full breakdown of each type.