Skip to content
DEV505 / Sound ManagerDOCUMENTATION

DEV505 / SOUND LAB / 05

A little rain.

Blend a storm, then hear thunder from its strike.

The Storm preset has brought rain to 100% and wind to 85%. The demo changes the sound parameters and the scene's visual effects together.
Weather in Unity: a full storm. The real scene controls and status readouts are visible.

The Storm preset has brought rain to 100% and wind to 85%. The demo changes the sound parameters and the scene's visual effects together.

In Unity’s Project window, open Assets/DEV505/SoundManager/Samples/05-Weather/Demo.unity. The supplied scene already has its Sound Manager, event registrations, generated keys, camera, and Audio Listener. Press Play, wait for the demo to be ready, and click the Game view before using the keyboard. If you are setting up a separate scene, follow Your first sound first.

Control Action
Space Start or clear the weather.
1 Choose light rain.
2 Choose a storm.
T / thunder button Request a strike when available.
Rain and wind sliders Set the two weather targets.

Start with light rain, then choose Storm. Listen as the rain fills out and wind strengthens over time. Trigger thunder: the lightning flash comes first, then the rumble. Clear the weather immediately after another strike to cancel a thunder request still waiting in its delay.

Rain and wind use a 2D event, providing a broad background. Thunder uses a 3D event at the strike point. The listener stays in the scene’s central listening area, so different strike positions change where the rumble is heard.

The island is dry and the weather session is stopped. This gives a quiet starting point for comparison with the storm.
Weather in Unity: before the rain. The real scene controls and status readouts are visible.

The island is dry and the weather session is stopped. This gives a quiet starting point for comparison with the storm.

This is the actual flash, captured about 0.08 seconds after the strike. The demo creates the light and bolt immediately; the Thunder graph delays its sound. The HUD counter updates separately and still shows the previous count in this frame.
Weather in Unity: the first lightning flash. The real scene controls and status readouts are visible.

This is the actual flash, captured about 0.08 seconds after the strike. The demo creates the light and bolt immediately; the Thunder graph delays its sound. The HUD counter updates separately and still shows the previous count in this frame.

Sounds.Weather supplies the continuous weather bed. Sounds.Thunder supplies a single delayed response. Both use the weather controller’s owner token, allowing one StopOwned call to clean up the whole interaction.

Rain and wind have their own groups. Parameters shape continuous layers while the weather session is running.
Weather in Unity: the Weather graph. The graph nodes and their connections are visible.

Rain and wind have their own groups. Parameters shape continuous layers while the weather session is running.

The Rain value controls drizzle and downpour through separate curves. The curves determine how much of each layer you hear at a given rain level.
Weather in Unity: blend the rain layers. The graph nodes and their connections are visible.

The Rain value controls drizzle and downpour through separate curves. The curves determine how much of each layer you hear at a given rain level.

The Weather graph starts looping layers and maps Rain and Wind into their levels. Rain moves toward its target at 0.35 units per second upward and 0.5 downward; Wind uses 0.25 and 0.4. The demo starts both at zero in the initial context, then sets the requested targets, so the storm grows in instead of starting at full level.

The controller reads the current smoothed values to drive the rain and cloud visuals. The sound graph does not render those effects.

A delay separates the flash from its rumble. Random Clip chooses a thunder variation, and the event ends after playback finishes.
Weather in Unity: the Thunder graph. The graph nodes and their connections are visible.

A delay separates the flash from its rumble. Random Clip chooses a thunder variation, and the event ends after playback finishes.

On Start passes through a 0.55-second Delay before thunder plays. The demo supplies the strike position when it starts this 3D event.
Weather in Unity: wait before the rumble. The graph nodes and their connections are visible.

On Start passes through a 0.55-second Delay before thunder plays. The demo supplies the strike position when it starts this 3D event.

Thunder’s On Start reaches a 0.55-second Delay, then plays a randomly selected thunder variation. Playback speed varies slightly, from 0.92 to 1.06. After the recording finishes, the graph ends. This is a fixed artistic delay, not a calculation of the physical speed of sound from distance.

Initial weather values · excerpt
var owner = service.OwnerOf(this);
var context = SoundPlayContext.At(transform.position, owner)
.With(SoundParameters.Weather.Rain, 0f)
.With(SoundParameters.Weather.Wind, 0f);
var result = SoundBus.Play(Sounds.Weather, context);

Retain the accepted handle, then send Rain and Wind targets with SetFloat. For each lightning strike, use the actual strike position:

A strike and shared cleanup · excerpt
var strike = SoundBus.Play(Sounds.Thunder,
SoundPlayContext.At(strikePosition, owner));
// Show the flash only if strike.Accepted.
// Later, when the player clears the weather:
service.StopOwned(owner, 0.85f);

The delay lives inside that thunder play. Stopping the owner cancels pending graph work as well as stopping weather voices; there is no separate delayed C# call left to fire afterward. The complete recipe keeps the owner until disable cleanup and releases it there.

The graph enforces a 4-second thunder cooldown. The demo’s button waits 4.2 seconds and automatic strikes use a longer interval. In a strong storm (Rain above 0.78 and Wind above 0.65), the demo schedules automatic strikes: first after about 6 seconds, then at random intervals of 8–12 seconds. That scheduling belongs to the controller.

The cloud and island models, falling rain, flash light, lightning bolt, weather presets, and automatic strike schedule are demo features. Sound Manager supplies the looping layers, smoothing, random variations, delayed playback, spatial position, cooldown, and owner cleanup.

  • The rumble is not immediate. The graph deliberately waits after the visual flash.
  • Repeated strikes are refused. Respect the cooldown rather than retrying each frame.
  • Thunder happens after weather is cleared. Use the same owner for both events and stop that owner; stopping only the Weather handle leaves independent Thunder plays alive.
  • The sliders change before the sound settles. They display targets; the graph smooths its current values.

These are the saved graph settings. A play can supply different initial parameter values. Float smoothing is measured in units per second; a rate of 0 applies changes immediately.

Sounds.Thunder

Position
3D · 4–20 units (minimum–maximum distance)
Overlapping plays
2 · ReplaceOldest
Cooldown
4 seconds between accepted requests
Owner loss
Stop
Keep Alive
Off — ends when its work is finished

No exposed parameters.

Signals: None authored.

Sounds.Weather

Position
2D
Overlapping plays
1 · ReplaceOldest
Cooldown
None
Owner loss
Stop
Keep Alive
Off — ends when its work is finished
ParameterTypeDefaultRangeRise / fall rate
RainFloat00–10.35 / 0.5
WindFloat00–10.25 / 0.4

Signals: None authored.

For the meaning of these settings, see Playback settings. The default numbers above come from the Unity graph audit stored with this documentation.

Open the complete integration recipe for the script, Inspector setup, a short test, and cleanup. Use Play context for initial values and placement, and SoundBus for playback controls.

All Weather Unity captures includes further states and readable graph details, with steps to reproduce each view.