Skip to content
DEV505 / Sound ManagerDOCUMENTATION

DEV505 / SOUND LAB / 09

A little elsewhere.

Let a world go. Choose which sounds stay behind.

After the old world owner is destroyed, the departure echo is still alive. Detach allows that sound to finish at the departure position.
Portals in Unity: let the departure echo linger. The real scene controls and status readouts are visible.

After the old world owner is destroyed, the departure echo is still alive. Detach allows that sound to finish at the departure position.

In Unity’s Project window, open Assets/DEV505/SoundManager/Samples/09-Portals/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 / Step through Cross to the other world, or wake the portals when closed.
E / Echo lingers Toggle the departure’s owner-loss policy between crossings.
X / close-or-wake control Close or wake the portals.

Begin in Mint Meadow with Echo lingers enabled. Step through, and listen behind you as the departure echo continues while the destination ambience arrives. Turn Echo lingers off and cross again. This time the same departure recording stops when the outgoing sound object is removed.

The player and listener travel together. The change you hear comes from both source placement and listener movement. These are two destinations inside one Unity scene; the demo does not load or unload scene files.

The first world owns its ambience and portal hum. An owner groups their lifetime with that world.
Portals in Unity: start in Mint Meadow. The real scene controls and status readouts are visible.

The first world owns its ambience and portal hum. An owner groups their lifetime with that world.

The player is partway through the crossing animation. The departure echo has started while the old world still exists.
Portals in Unity: step through the portal. The real scene controls and status readouts are visible.

The player is partway through the crossing animation. The departure echo has started while the old world still exists.

The second world has appeared with its own ambience and portal hum. The arrival cue marks the completed trip.
Portals in Unity: arrive in Crystal Cove. The real scene controls and status readouts are visible.

The second world has appeared with its own ambience and portal hum. The arrival cue marks the completed trip.

Echo lingers is off for the return trip. When the old world owner is destroyed, the Stop-policy departure play ends instead of continuing.
Portals in Unity: stop the echo with its owner. The real scene controls and status readouts are visible.

Echo lingers is off for the return trip. When the old world owner is destroyed, the Stop-policy departure play ends instead of continuing.

Event Role
Sounds.PortalWorld Loop the selected world’s ambience.
Sounds.PortalHum Loop the portal’s nearby hum.
Sounds.PortalEcho Departure recording with owner loss set to Detach.
Sounds.PortalCut The same departure recording with owner loss set to Stop.
Sounds.PortalArrival Short cue on arrival.

The controller creates a temporary audio-rig GameObject at the gate and obtains service.OwnerOf(rig). World and Hum follow that object’s Transform and share its owner. PortalWorld.Ambience initially selects Meadow or Crystals from its allowed clip list.

Each world starts this event with its own clip and gain. The continuous ambience belongs to that world's owner.
Portals in Unity: world ambience. The graph nodes and their connections are visible.

Each world starts this event with its own clip and gain. The continuous ambience belongs to that world's owner.

This loop follows the portal in 3D and belongs to the world. Destroying the world also stops its hum.
Portals in Unity: the portal's nearby hum. The graph nodes and their connections are visible.

This loop follows the portal in 3D and belongs to the world. Destroying the world also stops its hum.

The ambience and hum graphs start loops and respond to stopping. During departure, Echo or Cut starts on the outgoing rig. Midway through travel, the controller destroys that rig. Its owner and follow target are now gone.

PortalEcho uses Detach. Losing the owner leaves this play running so its departure sound can finish.
Portals in Unity: owner loss: Detach. The saved event values are visible in the Inspector.

PortalEcho uses Detach. Losing the owner leaves this play running so its departure sound can finish.

PortalCut uses Stop. Losing the owner stops this play; it does not keep a detached departure echo alive.
Portals in Unity: owner loss: Stop. The saved event values are visible in the Inspector.

PortalCut uses Stop. Losing the owner stops this play; it does not keep a detached departure echo alive.

Owner-loss Stop retires the world ambience and hum. With Echo lingers enabled, the departure uses Detach: the runtime drops the missing target and lets playback finish at the last known position. It does not attach the old echo to the arriving player. With Echo lingers disabled, PortalCut uses Stop, so that departure ends with its owner.

The departure echo uses variation and plays at the departure position. Its owner-loss policy is Detach, shown separately below.
Portals in Unity: a departure that can linger. The graph nodes and their connections are visible.

The departure echo uses variation and plays at the departure position. Its owner-loss policy is Detach, shown separately below.

A short cue plays at the destination to mark the new world's arrival, then ends.
Portals in Unity: mark the arrival. The graph nodes and their connections are visible.

A short cue plays at the destination to mark the new world's arrival, then ends.

The destination creates its own audio rig, starts its ambience and hum, and adds Arrival. The old echo and new world can therefore overlap without belonging to the same lifetime.

Start on a temporary rig · excerpt
var owner = service.OwnerOf(rig);
var context = SoundPlayContext.Following(rig.transform, owner);
var result = SoundBus.Play(Sounds.PortalEcho, context);

rig is a GameObject and service is ready. Following supplies the position; the owner token groups the interaction’s lifetime. Destroying the rig later lets each event apply its authored owner-loss policy.

Do not call StopOwned as part of the Detach comparison. That explicitly asks all owned plays to stop, removing the behavior you are trying to hear. Owner loss and an explicit stop request are different operations.

The full controller keeps its handles, including detached departures. On disable it explicitly stops those handles and destroys remaining rigs, so leaving the demo does not leave echoes behind. The smaller recipe demonstrates the two policies using one temporary object and a short delay before destruction.

The crossing animation, islands, world selection, listener travel, portal glow, and rig creation/destruction belong to PortalsDemo. Sound Manager supplies ownership, following, event-specific loss policies, and sound playback. Detach preserves sound position and lifetime; it does not preserve the destroyed visual object.

  • The echo vanishes even with Detach. Check for an explicit StopOwned or StopAll call before destroying the owner.
  • The echo moves with the destination. Keep the outgoing sound on its own rig; do not reuse the player as its follow target.
  • The echo survives after leaving the demo. Retain detached handles and stop them during controller cleanup.
  • A scene-loading system is expected. This sample uses GameObject destruction within one visible scene. Adapt ownership to your own scene-loading lifecycle separately.

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.PortalArrival

Position
3D · 3–22 units (minimum–maximum distance)
Overlapping plays
3 · ReplaceOldest
Cooldown
None
Owner loss
Stop
Keep Alive
Off — ends when its work is finished

No exposed parameters.

Signals: None authored.

Sounds.PortalCut

Position
3D · 3–22 units (minimum–maximum distance)
Overlapping plays
3 · ReplaceOldest
Cooldown
None
Owner loss
Stop
Keep Alive
Off — ends when its work is finished

No exposed parameters.

Signals: None authored.

Sounds.PortalEcho

Position
3D · 3–22 units (minimum–maximum distance)
Overlapping plays
3 · ReplaceOldest
Cooldown
None
Owner loss
Detach
Keep Alive
Off — ends when its work is finished

No exposed parameters.

Signals: None authored.

Sounds.PortalHum

Position
3D · 3–22 units (minimum–maximum distance)
Overlapping plays
2 · ReplaceOldest
Cooldown
None
Owner loss
Stop
Keep Alive
Off — ends when its work is finished

No exposed parameters.

Signals: None authored.

Sounds.PortalWorld

Position
3D · 3–22 units (minimum–maximum distance)
Overlapping plays
2 · ReplaceOldest
Cooldown
None
Owner loss
Stop
Keep Alive
Off — ends when its work is finished
ParameterTypeDefaultRangeRise / fall rate
AmbienceAssetPortal_MeadowAllowed clips belowNot smoothed

Ambience allowed clips: Portal_Meadow.wav, Portal_Crystals.wav.

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 Portals Unity captures includes further states and readable graph details, with steps to reproduce each view.