In a Game
In a Game
Everything is in the GlowingRifts.SoundGraph namespace.
🔊 SoundGraph Source
Add Component > GlowingRifts > SoundGraph Source adds the component and an AudioSource. It behaves like an AudioSource: playOnAwake, Play(), Stop(), Pause(), UnPause(), isPlaying, and the AudioSource’s volume, 3D settings and mixer output all apply.
The Inspector lists the graph’s exposed properties. Tick one, or edit it, to override the graph’s value on that object. In Play Mode it shows live values with a Fire button for triggers.
🧑💻 From Code
using GlowingRifts.SoundGraph;
using UnityEngine;
public class Weather : MonoBehaviour
{
[SerializeField] SoundGraphSource source;
void Update()
{
source.SetFloat("Density", rain); // exposed Blackboard properties
}
public void Thunder() => source.SetTrigger("Thunder");
float rain;
}| Method | Does |
|---|---|
SetFloat(name, value) | Sets a Float property |
SetBool(name, value) | Sets a Bool property |
SetTrigger(name) | Fires a Trigger property |
SetClip(name, clip) | Swaps an Audio Clip property |
SetMidiClip(name, clip) | Swaps a MIDI Clip property |
SetParameter("node.input", value) | Sets any unwired node input |
SetControl(name, 0..1) | Sets a Knob or Analog Sensor node |
PressButton(name) | Taps a Button node |
Tip
Prefer Blackboard properties for anything a game changes. They are named, ranged and smoothed.
🌐 Platforms
SoundGraph runs in the Editor, standalone builds and WebGL. The same patch sounds the same everywhere.
🔩 Limits
| Limit | Value |
|---|---|
| Nodes | 128 |
| Wires | 256 |
| Polyphonic voices | 8 |
| Audio clips | 16 |