Reference Devices compiles

echo_effect_device: Cave Reverb with a Live HUD

Make your cave sound like a cave and your forest sound dry — all switched live from Verse. The echo_effect_device adds a delayed, repeating tail to your Patchwork audio, and its Enable()/Disable() methods let you toggle that echo the instant a player crosses a trigger. We'll wire two trigger_devices to the echo AND show players a HUD widget that tracks the current audio state.

Updated Examples verified on the live UEFN compiler

What you'll learn

  • How the echo_effect_device re-emits Patchwork audio with a repeating echo tail
  • How to toggle the echo live from Verse using Enable() / Disable()
  • How to drive that toggle from trigger_device events
  • How to build a player HUD with GetPlayerUI[], AddWidget, a canvas, and a text_block, then update it live with SetText

How it works

The echo_effect_device is a Patchwork audio effect (class<concrete><final>(patchwork_device)). Any sound flowing through your Patchwork inputs is re-emitted with a delayed, repeating tail — perfect for tunnels, haunted halls, or boss arenas.

Like all creative devices it inherits Enable() and Disable(), which turn the effect ON and OFF. The device has no events of its own, so you decide when to flip it — usually in response to another device. Here two trigger_devices (cave entrance and exit) fire TriggeredEvent, and our handlers call Enable() / Disable().

To make the effect visible as well as audible, we build one on-screen HUD per player. We reach a player's UI with the fallible GetPlayerUI[Player] (bind it inside an if with []), AddWidget a canvas holding a text_block, and later call SetText on that block so "ECHO ON / ECHO OFF" tracks the audio in real time.

A couple of correctness notes:

  • SetText and DefaultText take a message, not a string — define your labels once with <localizes> (e.g. EchoOnMsg<localizes> : message = "ECHO ON") and pass those.
  • GetPlayerUI[Player] is fallible — it lives in a failure context (if (UI := GetPlayerUI[Player]):), and returns a value we call AddWidget on with parens.
  • Trigger handlers receive ?agent (an optional). We don't need the agent here, so we ignore it.
  • Because the HUD is a single shared text_block, updating its text once updates it for everyone who was shown it.

Let's build it

using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/Patchwork }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }

# UI text is message-typed in Verse: <localizes> turns a literal into a message.
EchoOnMsg<localizes> : message = "ECHO ON"
EchoOffMsg<localizes> : message = "ECHO OFF"

# Toggles a Patchwork echo effect and shows a live HUD label.
haunted_cave := class<concrete>(creative_device):

    @editable EntranceTrigger : trigger_device = trigger_device{} # cave mouth
    @editable ExitTrigger : trigger_device = trigger_device{}     # cave exit
    @editable CaveEcho : echo_effect_device = echo_effect_device{} # wired to Patchwork

    # One shared text block whose text we update as the echo toggles.
    StatusText : text_block = text_block{DefaultText := EchoOffMsg}

    OnBegin<override>()<suspends>:void =
        # Start dry (open forest): echo off.
        CaveEcho.Disable()
        # Show the HUD to every current player.
        for (Player : GetPlayspace().GetPlayers()):
            ShowHUD(Player)
        # Wire the triggers to our handlers (device events: no () before Subscribe).
        EntranceTrigger.TriggeredEvent.Subscribe(OnEnterCave)
        ExitTrigger.TriggeredEvent.Subscribe(OnLeaveCave)

    # Build and attach the HUD widget for one player.
    ShowHUD(Player : player):void =
        # GetPlayerUI is fallible: bind it with [] inside the if.
        if (UI := GetPlayerUI[Player]):
            Root : canvas = canvas:
                Slots := array:
                    canvas_slot:
                        Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.05}, Maximum := vector2{X := 0.5, Y := 0.05}}
                        Alignment := vector2{X := 0.5, Y := 0.0}
                        SizeToContent := true
                        Widget := StatusText
            UI.AddWidget(Root)

    # Entrance trigger fires -> echo ON, update label.
    OnEnterCave(Agent : ?agent):void =
        CaveEcho.Enable()
        StatusText.SetText(EchoOnMsg)

    # Exit trigger fires -> echo OFF, update label.
    OnLeaveCave(Agent : ?agent):void =
        CaveEcho.Disable()
        StatusText.SetText(EchoOffMsg)```

## Try it yourself

1. Place an **echo_effect_device**, two **trigger_device**s (entrance and exit), and connect the echo device into your Patchwork audio graph so real sound flows through it.
2. Add this Verse device to the level, build Verse code, and assign the three `@editable` dropdowns in the Details panel.
3. Launch a session. The HUD should read **ECHO OFF** in the open forest.
4. Walk onto the entrance plate  hear footsteps reverberate and the HUD flip to **ECHO ON**. Walk onto the exit plate to go dry again.
5. Experiment: change the anchors to reposition the HUD, or add a second `echo_effect_device` for a deeper tail.

## Recap

You toggled a Patchwork audio effect live with `Enable()` / `Disable()`, driven by `trigger_device` `TriggeredEvent`s. You also built a real player HUD  reaching each player's UI with the fallible `GetPlayerUI[]`, attaching a `canvas` + `text_block` via `AddWidget`, and updating it in real time with `SetText`. The same pattern works for any device you want to flip in response to gameplay while keeping players informed.

Guides & scripts that use echo_effect_device

Step-by-step tutorials that put this object to work.

Build your own lesson with echo_effect_device

Generate a personalized, step-by-step lesson plan built around this object — grounded in this exact reference and our compile-verified knowledge base.

Build a lesson →