Skip to content
DEV505 / Sound ManagerDOCUMENTATION

DEV505 / API REFERENCE

Keys, events, and libraries

Understand generated names and the assets they refer to.

Use Sounds.Campfire to ask for a sound by key. The active manager looks up the registered event, then plays its graph. Read Managers, libraries, and keys for the setup steps.

SoundKey(string name) stores an event name. Name returns it, or null for an empty/default key. IsValid means it has a nonempty name; it does not prove registration. Comparison is case-sensitive. The implicit string conversion allows SoundBus.Play("Campfire"), but generated names reduce typing mistakes.

Both Equals overloads compare name/hash identity. GetHashCode returns the cached name hash. ToString returns the name or <no key>. Neither whitespace trimming nor registration happens inside the key constructor. Library collection trims authored custom keys before registration.

SoundKey · declared members
public SoundKey(string name)
public string Name { get; }
public bool IsValid { get; }
public static implicit operator SoundKey(string name)
public bool Equals(SoundKey other)
public override bool Equals(object other)
public override int GetHashCode()
public override string ToString()

Run Tools → DEV505 → Sound Manager → Generate Sound Keys. Sounds contains static readonly keys for your project’s events. SoundParameters contains nested event classes with declared parameter IDs. They are generated project output, not a fixed catalogue shipped in every user’s game.

Generated names from the supplied project · excerpt
var context = SoundPlayContext.At(transform.position)
.With(SoundParameters.Campfire.Intensity, 0.4f);
var result = SoundBus.Play(Sounds.Campfire, context);

This belongs in a component with Campfire registered. Save the handle and stop the loop later. The current generated sample catalogue includes the ten demos’ event keys; names and declarations are recorded in this documentation’s API inventory. There is no generated signal-ID class in this revision.

Unity imports each .soundgraph into a SoundEvent. You assign the graph asset to a manager, library, or emitter and Unity uses this imported object. Edit the graph and its Inspector settings; do not try to change compiled records during gameplay.

Member Meaning
EventId Identity of the source event asset. Duplicated graphs get different event identities.
Revision Content hash for the imported event. Useful for diagnostics and source tracking.
Diagnostic Why compilation failed, or null when there is no diagnostic.
IsValid Whether the event has a compatible schema, no diagnostic, and nodes to run.
Parameters Read-only list of declared parameter records. Use generated IDs for normal gameplay.
CopySettings() Returns a new settings copy, including its own rolloff curve. This allocates; keep it if you need repeated reads. Editing the copy does not change the saved event.
GetParameterId(string name) Resolve a declared parameter by exact name; returns an invalid ID when absent or null.
GetSignalId(string name) Resolve an On Signal name; returns an invalid ID when absent or null.
Inspect registered content · excerpt
if (SoundBus.TryResolve(Sounds.Campfire, out var sound))
{
var intensity = sound.GetParameterId("Intensity");
var settings = sound.CopySettings();
Debug.Log($"Parameter found: {intensity.IsValid}, 3D blend: {settings.spatialBlend}");
}

This can run in a component method after the manager registers the event. It does not start a sound. Source-only compilation members (SchemaVersion, GraphId, Nodes, Edges, and Initialize) are classified as infrastructure in the inventory; they are not the gameplay authoring path. Parameter record authoring and compilation details belong to the advanced graph reference.

SoundEvent · declared members
public string EventId { get; }
public string Revision { get; }
public string Diagnostic { get; }
public bool IsValid { get; }
public IReadOnlyList<SoundParameterRecord> Parameters { get; }
public SoundEventSettings CopySettings()
public SoundParameterId GetParameterId(string name)
public SoundSignalId GetSignalId(string name)

Create a library with Assets → Create → DEV505 → Sound Manager → Sound Library. Its entries array defaults to empty. Each SoundLibraryEntry has a sound event reference and a key string. Leave key empty to use the event asset name; set it to preserve a custom name across an asset rename.

Assign the library to the manager’s Libraries list. It does not register or load itself. The manager collects direct events first, then libraries in order, keeping the first entry for a repeated event. A duplicate key on a different event is diagnosed instead of silently replacing the first event’s key.

SoundLibrary · declared members
public SoundLibraryEntry[] entries
SoundLibraryEntry · declared members
public SoundEvent sound
public string key

All Unity asset access belongs on the main thread. The common path uses key-based playback; SoundBus.Play(sound, context) also supports a direct asset reference, but the asset must still be registered on the active service.