using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/UI }
using { /Verse.org/Simulation }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/Diagnostics }
# Dynamic, interpolated UI text is built with <localizes> message functions
# (this is how the Verse UI APIs accept text -- DefaultText/SetText take a
# `message`, not a `string`). Same pattern our shipping code uses.
CellLabel<localizes>(Row : int, Col : int) : message = "R{Row}C{Col}"
PromptLabel<localizes> : message = "Click a button..."
ClickedLabel<localizes>(Row : int, Col : int) : message = "Clicked R{Row}C{Col}!"
# Holds one generated button plus the grid coordinate it represents, so we can
# both lay it out AND wire its click handler without recomputing positions.
grid_cell := struct:
Button : button_loud
Row : int
Col : int
# A device that DYNAMICALLY GENERATES a grid of clickable button widgets in
# Verse (no manual widget placement in the editor) and adds it to a player's
# on-screen UI. Grounded in our shipping grid-of-buttons pattern from
# Scripts/UISystem/minigame_vote_ui.verse (button_loud rows in a stack_box,
# laid out inside a canvas, added via GetPlayerUI[].AddWidget, with each
# button wired to OnClick().Await()).
Verse Library
verse
01 Device
Programmatically generates and lays out a clickable grid of UI buttons, wiring click handlers without editor placement.
verse-library/yt-dynamically-generating-ui-button-grids-in-verse/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.