Toggle Rig State and Show Live HUD Feedback in Verse
What you'll learn
- How to structure a
creative_devicethat reacts to abutton_devicepress. - Safely flipping a
logicstate variable using Verse's fallible branching patterns. - Using
GetPlayerUI[],AddWidget, andtext_block.SetTextto push a live status label to every player's screen.
How it works
We track the rig mode in a mutable var IsIKActive : logic. A logic value is itself fallible, so we never modify it bare — we branch on if (IsIKActive?): and use set to write the opposite value.
The interesting part is the UI. GetPlayerUI[Player] is a <decides> function (note the [] brackets): it must be called inside a failure context because it fails when a player has no UI. We therefore call it inside if (UI := GetPlayerUI[Player]):. Once we hold the player_ui, we call AddWidget(Widget) to render our widget, and SetText(...) on a text_block to display the current mode.
Because AddWidget shows something on screen (a side effect that can't be rolled back), we create ONE text_block per player and reuse it — calling SetText on each toggle rather than adding a fresh widget every press. We loop over GetPlayspace().GetPlayers() so every connected client stays in sync.
Let's build it
Place a button_device in your level, then drop this device in and assign the button to the ToggleButton field in the Details panel.
using { /Fortnite.com/Devices }
using { /Fortnite.com/UI }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/UI }
# Toggles a modeled IK/FK rig state and shows it live on every player's HUD.
ik_fk_toggle_device := class<concrete>(creative_device):
# Assign a placed button_device in the UEFN Details panel.
@editable ToggleButton : button_device = button_device{}
# true = IK (Inverse Kinematics), false = FK (Forward Kinematics).
var IsIKActive : logic := false
# One reusable text_block per player, keyed by the player.
var StatusLabels : [player]text_block = map{}
OnBegin<override>()<suspends>: void =
# Device events do NOT need () before .Subscribe.
ToggleButton.InteractedWithEvent.Subscribe(OnRigToggle)
Print("IK/FK Rig System Initialized (FK by default)")
# Runs when a player presses the button.
OnRigToggle(Agent : agent): void =
# A logic var is fallible: branch on its truth, then set the opposite.
if (IsIKActive?):
set IsIKActive = false
else:
set IsIKActive = true
# Build the status message from the new state.
StatusText := if (IsIKActive?) then "RIG MODE: IK" else "RIG MODE: FK"
Print("Rig toggled -> {StatusText}")
# Push the update to every connected player's HUD.
for (Player : GetPlayspace().GetPlayers()):
ShowStatus(Player, StatusText)
# Adds the widget once per player, then reuses it via SetText.
ShowStatus(Player : player, Text : string): void =
# GetPlayerUI is <decides> — call with [] inside a failure context.
if (UI := GetPlayerUI[Player]):
Label := GetOrCreateLabel(Player, UI)
Label.SetText(StringToMessage(Text))
# Returns the player's cached text_block, creating + adding it if needed.
GetOrCreateLabel(Player : player, UI : player_ui): text_block =
if (Existing := StatusLabels[Player]):
Existing
else:
NewLabel := text_block{}
UI.AddWidget(NewLabel)
if (set StatusLabels[Player] = NewLabel) {}
NewLabel
# Wraps a string into a message for SetText.
StringToMessage<localizes>(Value : string): message = "{Value}"```
> Note: `SetText` takes a `message`, so `StringToMessage` here stands for wrapping your string in a localizable message before display. Declare it as `StringToMessage<localizes>(S:string):message = "{S}"` at file scope if your project doesn't already provide a helper.
## Try it yourself
1. Place your `ik_fk_toggle_device` and a `button_device` in the scene.
2. Assign the button to the `ToggleButton` field in the Details panel.
3. Press the button in-game — the HUD label flips between `RIG MODE: IK` and `RIG MODE: FK`.
4. Extend `OnRigToggle` to also drive real animation (e.g. enable/disable a `vfx_spawner_device`) alongside the label.
## Recap
- Toggle a `logic` with `if (Val?): set Val = false else: set Val = true` — never write a bare `logic`.
- `GetPlayerUI[]` is `<decides>`: call it with `[]` inside an `if`/`for` failure context.
- `AddWidget` renders a widget and is an unrollbackable side effect — add once, then reuse via `SetText`.
- Cache widgets in a `[player]text_block` map so each client keeps a single, updatable label.
- Iterate `GetPlayspace().GetPlayers()` to keep every connected player's HUD in sync.
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 Toggling IK/FK Rig State on Character Instances via Verse 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.