Skip to content
DEV505 / Sound ManagerDOCUMENTATION

DEV505 / API REFERENCE

Parameter values and IDs

Choose the correct type, set initial values, and inspect smoothing.

A parameter ID identifies a declared graph value. A SoundValue carries its value and type. Start with the parameter guide before using this reference.

Use SoundParameters.Campfire.Intensity or resolve a name once with eventAsset.GetParameterId("Intensity"). The generated fields and resolved IDs use stable identities so moving or renaming a declaration does not silently retarget a cached ID. An ID with a stable identity will not fall back to a different parameter merely because its old name matches.

Name is the remembered name. IsValid means the name was resolved to a declared slot; it is false for a default or unresolved ID. String overloads use name-only IDs internally, which can still match when applied. Declared(name, index, stableId) is public for generated code: index is zero-based and the stable ID comes from the graph. Prefer generation over inventing these values.

Equals(SoundParameterId) and Equals(object) compare stable IDs, or names when no stable ID exists, using case-sensitive comparison. GetHashCode follows that identity. ToString returns Name.

SoundParameterId · declared members
public readonly string Name
public static SoundParameterId Declared(string name, int index, string stableId)
public bool IsValid { get; }
public bool Equals(SoundParameterId other)
public override bool Equals(object obj)
public override int GetHashCode()
public override string ToString()

Build values with the factory matching the declared type:

Update a running Workshop · excerpt
bool changed = SoundBus.SetParameter(
workshop, SoundParameters.Workshop.Tool, SoundValue.Int(2));

This excerpt requires a retained Workshop handle named workshop. It changes the Tool value to Drill; the graph still needs its own signal or flow to act on the choice. It does not create a new play.

Float(float) stores type = Float and number; Int(int) stores integer; Bool(bool) stores boolean; Asset(AudioClip) stores asset. Each returns a value. Only the field matching type is meaningful. The factories themselves do not validate a graph’s restrictions; validation happens when you submit the value.

ToString() formats the active value for a log: a number, a bool, the clip name, or None for an empty clip. Do not use this display text to serialize parameters.

SoundValue · declared members
public SoundParameterType type
public float number
public int integer
public bool boolean
public AudioClip asset
public static SoundValue Float(float value)
public static SoundValue Int(int value)
public static SoundValue Bool(bool value)
public static SoundValue Asset(AudioClip value)
public override string ToString()
SoundParameterType · declared members
Float
Int
Bool
Asset

SoundFloatOverride stores Parameter and Value. Its constructors accept either a parameter ID or a name plus a Float. Name returns Parameter.Name. Use its array in context.Parameters or its span in the service’s extra-parameter overload.

SoundParameterOverride stores a typed Value and Parameter. Its public constructor takes a string name and SoundValue. The ID-taking constructor is internal; use context.With(generatedId, value) for a small typed list with generated IDs.

Initial Engine values · excerpt
var context = SoundPlayContext.At(transform.position);
context.Parameters = new[]
{
new SoundFloatOverride(SoundParameters.Engine.Rpm, 0.25f)
};
context.TypedParameters = new[]
{
new SoundParameterOverride("Load", SoundValue.Float(0.5f))
};
var result = SoundBus.Play(Sounds.Engine, context);

This is a component-method excerpt with Engine registered. Both arrays are read during the call and not retained. The typed array overrides matching entries from the Float array; With entries apply after both. All entries must be acceptable to the event.

SoundFloatOverride · declared members
public readonly SoundParameterId Parameter
public readonly float Value
public SoundFloatOverride(SoundParameterId parameter, float value)
public SoundFloatOverride(string name, float value)
public string Name { get; }
SoundParameterOverride · declared members
public readonly SoundParameterId Parameter
public readonly SoundValue Value
public SoundParameterOverride(string name, SoundValue value)

Current is the typed value the graph reads now. Target is its requested value. They differ while a Float with a positive rise/fall rate is moving toward its target. The constructor stores the two values; it does not change a play.

Read a live Campfire parameter · excerpt
var service = SoundServices.Current;
if (service != null && service.TryGetParameter(
fire, SoundParameters.Campfire.Intensity, out var state))
{
Debug.Log($"Now: {state.Current.number}, target: {state.Target.number}");
}

Here fire is a saved Campfire handle. Check the bool before reading the output. A wrong parameter or ended play returns false. number is appropriate because Intensity is a Float; read the matching field for other types.

SoundParameterState · declared members
public readonly SoundValue Current
public readonly SoundValue Target
public SoundParameterState(SoundValue current, SoundValue target)

Call playback setters and queries on Unity’s main thread. Unknown parameters and refused values return false from live setters; initial invalid overrides reject the play. See service overloads for SetInt, SetBool, SetAsset, and owner-wide changes.