ReferenceVerse

Get Player Ui

get player ui

Updated
Watch the Knot — get-player-ui in ~90 seconds.

A pirate steps into the sunlit Crystal Grotto, and instantly, a custom gem-tracking HUD snaps onto their screen.

To draw custom UI, you first need to grab the player's personal screen space using GetPlayerUI, which is a failable call that might not exist yet.

We loop through our players, safely unwrap their UI with the failable bracket syntax, and then call AddWidget to attach our custom canvas.

Reach for GetPlayerUI whenever you need to push custom menus, health bars, or scoreboards directly to a specific player's screen.

ui_demo := class(creative_device):
    @editable
    MyCanvas : canvas = canvas{}
    OnBegin<override>()<suspends>:void =
        for (Player : GetPlayspace().GetPlayers()):
            if (UI := GetPlayerUI[Player]):
                UI.AddWidget(MyCanvas)

Build your own lesson with get-player-ui

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →