Verse HUD Messages: On-Screen Notifications and Custom Widgets
Tutorial beginner compiles

Verse HUD Messages: On-Screen Notifications and Custom Widgets

Updated beginner Code verified

What you'll learn

  • How to reference a hud_message_device in Verse and configure its text and duration.
  • How to show a message to all players versus a single agent.
  • How to reach every player through GetPlayspace().GetPlayers().
  • How to build and attach your OWN on-screen widget with GetPlayerUI[] and AddWidget.

How it works

There are two complementary ways to put text on screen from Verse:

  1. The hud_message_device — a Creative device that queues and renders HUD notifications. You call SetText(message) and SetDisplayTime(float) to configure it, then Show() to display to everyone (or Show(Agent) to target one player). 0.0 display time means the message stays until cleared.

  2. The Player UI stack — every player has a player_ui you obtain with GetPlayerUI[Player] (fallible, so it lives inside an if). You create a text_block widget, set its text, and call AddWidget(Widget) to layer it directly on top of the HUD. This is how you build custom, persistent overlays that the HUD device can't produce.

Because SetText expects a message, we build the text with interpolation inside a message literal — there is no string + concatenation in Verse.

Let's build it

Place a HUD Message Device in your level, then place a Verse device and link the HUD to its HUD field in the Details panel.

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

# A device that broadcasts a HUD notification AND adds a custom widget per player.
hud_message_demo := class<concrete>(creative_device):

    # Link this to a HUD Message Device placed in your level.
    @editable HUD : hud_message_device = hud_message_device{}

    # Helper to build a message from a string literal.
    WelcomeText<localizes>(): message = "Welcome to the arena!"
    LabelText<localizes>(): message = "HUD active for you!"

    OnBegin<override>()<suspends>: void =
        # 1) Configure and broadcast a HUD message to everyone.
        HUD.SetText(WelcomeText())               # SetText takes a message; use a localized message
        HUD.SetDisplayTime(5.0)                  # 0.0 = persistent; 5.0 = five seconds
        HUD.Show()                               # Show() with no agent targets all players

        # 2) Give each player their OWN custom on-screen widget.
        for (Player : GetPlayspace().GetPlayers()):
            # GetPlayerUI[] is fallible, so bind it inside an if.
            if (PlayerUI := GetPlayerUI[Player]):
                # Build a text widget and set its content via interpolation.
                Label := text_block{DefaultText := LabelText()}
                # AddWidget layers the widget onto this player's HUD.
                PlayerUI.AddWidget(Label)

        # 3) Wait, then clear the HUD message so it doesn't linger.
        Sleep(6.0)
        HUD.Hide()

        # 4) Show a targeted message to just the first player, if one exists.
        AllPlayers := GetPlayspace().GetPlayers()
        if (First := AllPlayers[0]):
            HUD.Show(First)```

## Try it yourself

- Change `SetDisplayTime(5.0)` to `0.0` and observe that the message becomes persistent until `Hide()` runs.
- Swap the broadcast `HUD.Show()` for a per-player loop calling `HUD.Show(Player)` so each player gets their own queued copy.
- Give the `text_block` different text per player using interpolation, e.g. based on the loop index.
- Call `HUD.ClearAllMessages()` instead of `Hide()` to flush every queued message.

## Recap

You drove a `hud_message_device` end to end  `SetText`, `SetDisplayTime`, `Show`/`Show(Agent)`, and `Hide`  and you learned the difference between broadcasting to everyone and targeting a single `agent`. You also reached every player through `GetPlayspace().GetPlayers()` and attached a custom `text_block` to each player's UI with `GetPlayerUI[]` and `AddWidget`. Together these give you both quick notifications and fully custom overlays.

Check your understanding

Test yourself with an interactive quiz and track your progress + earn XP — free for members.

Turn this into a guided course

Add Displaying On-Screen Messages via Verse and HUD Device to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in