Skip to content
DEV505 / Sound ManagerDOCUMENTATION

DEV505 / START HERE

Your first sound.

Set up a manager, choose where you listen, and play the included Campfire sound.

By the end of this guide, entering Play Mode will start a campfire sound. You will hear it catch fire, then continue crackling. No knowledge of sound graphs is needed yet.

Use the Sound Manager project or import the asset and its samples into your Unity project using the distribution you received. This documentation was checked with Unity 6000.6.0f1. It does not claim compatibility with older versions that have not been tested.

In Unity’s Project window—the list of files in your project—check that Assets/DEV505/SoundManager exists. Open Window → General → Console and resolve any red compile errors before continuing. In the supplied project, the required packages are already configured. Its demos use the Universal Render Pipeline and Input System; the script below does not need keyboard input or a particular rendering pipeline.

Choose Tools → DEV505 → Sound Manager → Getting Started. This opens the Sound Manager window, where you can prepare your scene and choose which sounds it can play. The panel also opens on Editor startup by default. Clear Show on Editor startup at the bottom if you prefer to open it yourself.

The panel has three sections:

Section What you can do here
Scene setup Add the manager, set up where you hear sounds from, and assign the included playback settings.
Register your sounds Give this scene’s manager a sound graph or library, create new ones, and generate their names for C# code.
Explore & author Open a demo, the included documentation file, the default audio mixer, or the playback settings.

For a quick listen, select 01 Campfire under Explore & author and click Open demo. Unity asks about unsaved scene changes before switching. Press the Editor’s Play button, then click Ignite fire in the Game view. Stop Play Mode before setting up your own scene below.

  1. Create a new scene with File → New Scene and select a basic scene template with a camera. Save it as FirstSoundDemo.
  2. In the Hierarchy—the list of objects in the open scene—select Main Camera.
  3. In the Inspector—the panel that shows the selected object’s settings—set its Transform → Position to X 0, Y 1, Z -3 and Rotation to 0, 0, 0.
  4. Check that the camera has an enabled Audio Listener component. This is the point from which you hear the scene. Use one active listener. The component is normally included on a new camera.

An empty scene is enough for this test. The script plays audio; it does not create a fire model or flames.

  1. Return to the Getting Started panel. Check that Scene setup shows FirstSoundDemo, then click Set up active scene.
  2. Check the three rows: Sound Manager, Listening point, and Playback settings. Setup adds missing components and assigns the included default settings. In this scene, it adds a Sound Listener to your camera alongside Unity’s Audio Listener.
  3. Under Register your sounds, drag Assets/DEV505/SoundManager/Samples/01-Campfire/Campfire.soundgraph from the Project window into the field beside Register. Unity imports this graph as a sound event—the sound recipe the manager will play.
  4. Click Register. To check the assignment, click Select on the Sound Manager row and expand Event keys in the Inspector. You should see Campfire pointing to the Campfire event.
  5. Save the scene with File → Save. The panel changes your scene, but does not save it for you. Scene setup and registration support Unity’s Undo.

If the scene already has a manager or assigned settings, setup keeps them. Once all three checks pass, the button changes to Check scene setup. If a row reports a disabled component or extra listeners, use Select to inspect it and follow the message. Setup only changes the active scene; keep one active manager and listening point across any scenes loaded together.

Register an event through the Inspector instead

Select your scene’s Sound Manager. Expand Sound sources → Direct events, add an entry with +, and drag the graph into it. This is the same assignment the panel makes for a new event. You only need to register it once.

Registering means telling this manager which events it may play. Having an event file somewhere in the project is not enough. Use one active manager; a second manager disables itself. The Inspector’s Show counters option is for debugging and can reduce frame rate while it updates the UI.

For several reusable events, use a library as described in Managers, libraries, and keys.

Click Generate sound keys in the Getting Started panel. You can also use Tools → DEV505 → Sound Manager → Generate Sound Keys. Wait for Unity to finish compiling.

This creates Sounds.cs and SoundParameters.cs in Assets/DEV505/SoundManager.Generated. Sounds.Campfire gives your script a checked name for the event. Generating a name does not register the event; the previous step does that.

If you use assembly definition files to divide your C# code into separate assemblies, add references to DEV505.SoundManager.Runtime and DEV505.SoundManager.Generated in your gameplay assembly. If you have not created an assembly definition, you can use the script below without this extra step.

  1. Create an Assets/Scripts folder if you do not already have one.
  2. Create a C# MonoBehaviour script there named FirstSound.cs. Open it, replace its contents with the code below, and save it. The filename must match the class name FirstSound.
  3. Return to Unity and wait for compilation. Create an empty GameObject named Fire sound with Position 0, 0, 0.
  4. Drag FirstSound.cs onto Fire sound in the Hierarchy. There are no Inspector references to assign on this script.
FirstSound.cs · complete component
using DEV505.SoundManager;
using UnityEngine;
public sealed class FirstSound : MonoBehaviour
{
private SoundHandle fire;
private void Start() => PlaySound();
[ContextMenu("Play sound")]
public void PlaySound()
{
if (!isActiveAndEnabled || !Application.isPlaying || SoundBus.IsAlive(fire))
return;
var result = SoundBus.Play(Sounds.Campfire, transform);
if (result.Accepted)
fire = result.Handle;
else
Debug.LogWarning($"Could not play Campfire: {result.Status}", this);
}
[ContextMenu("Stop sound")]
public void StopSound()
{
if (SoundBus.IsAlive(fire))
SoundBus.Stop(fire, 0.15f);
fire = default;
}
private void OnDisable() => StopSound();
}

Press Play. You should hear the ignition followed by crackling. Select Fire sound, open the First Sound component’s menu at its top right, and choose Stop sound. The crackle fades and the extinguish sound finishes. Choose Play sound from the same menu to start again.

Start() is a Unity method called when this component first starts running. It calls PlaySound() once. transform is the component that stores this object’s position; passing it makes the sound move with the object.

result.Accepted tells you the manager admitted the request. fire stores its handle, a value used to control that particular play later. SoundBus.IsAlive(fire) prevents another loop from starting while this one is still active. OnDisable() runs when the component is disabled and asks the sound to stop.

The script clears its saved handle after asking for a stop. You may still hear the ending. The sound graph controls that ending, including its own fades.

Open the Console and check the message from the script first.

What you see or hear What to do
NoManager Make sure the Sound Manager object and component are enabled in the running scene.
NotRegistered Stop Play Mode, drag Campfire into the Getting Started panel and click Register, then try Play again.
Panel setup buttons are unavailable Stop Play Mode, leave Prefab Mode, and wait for Unity to finish importing or compiling. Open the scene you want to set up.
Sounds or Campfire does not exist in code Generate Sound Keys. Check the sample is imported and any assembly references are set.
Graph error or InvalidEvent Select the graph asset and read its diagnostic. Use the supplied Campfire graph unchanged for this first test.
No error, but silence Check the Game view’s audio mute button, computer volume, the enabled camera Audio Listener, and the camera/fire positions above.
Sound starts later than expected A request may be accepted as Queued while clips load. Check the manager’s readiness and playback results if it never starts.
Two copies of the same fire Use this test in its own scene. Do not add it beside the demo’s existing fire controller.

Next, learn what happens when you play a sound, or make your own sound graph.