Unity + Playmaker: Update Slider Value as UI Text Percentage
In this Unity UI tutorial, learn how to use Playmaker to connect a slider value to UI text as a Percentage. Useful for displaying health, progress bars, settings, and more in Unity games. My discord link ► https://discord.gg/DgUdNDT7KU ► Download Unity at https://unity.com Chapters: 00:00 Introduc
This bonus tutorial adds a live percentage readout next to the fuel slider from the previous episode. The slider's value is a float between 0 and 1, and the on-screen text needs a whole-number percentage — so the whole exercise is a four-step conversion chain built in a single Playmaker state: get the value, multiply by 100, convert to int, convert to string, push to the UI.
Step 1 — Set up the text and a second FSM
The display is a TextMesh Pro object named Slider Text in the HUD UI canvas, with placeholder text of 100. Rather than cramming the UI logic into the player's existing FSM, keep things organized: rename that first FSM Rocket Controller, then use the FSM dropdown to Add FSM and name the new one Rocket Text UI. It gets one state — Rocket Text — whose only job is updating that number. Separating concerns like this keeps each FSM small enough to debug at a glance.
Step 2 — Pull the fuel value across FSMs
The rocket fuel float lives in the Rocket Controller FSM, so the new FSM has to fetch it. Create a float variable here named Rocket Fuel, then add an FSM Get Variable action. The target is the owner (both FSMs live on the same game object); click the three-dot icon, pick Rocket Controller as the source FSM, and store its rocket fuel value into your local Rocket Fuel. Check Every Frame — the readout should track the bar continuously.
Step 3 — Turn 0-to-1 into a percentage
The stored value runs from 0 to 1, but players expect 0 to 100. Add a Float Multiply that multiplies Rocket Fuel by 100, every frame. Floats carry decimal points, and "73.24862%" is nobody's idea of clean UI, so follow it with a Float To Int action converting the result into a new int variable, rocket fuel int — also every frame.
Step 4 — Convert to a string and set the text
TextMesh Pro text is a string, so one more hop: Convert Int To String takes rocket fuel int into a new string variable, Rocket Fuel Text, every frame. Then drag the Slider Text object from the hierarchy into the state, choose TextMesh Pro Set Property, scroll the long property list to the text string entry, uncheck the use-variable toggle so you can assign your own, and feed it Rocket Fuel Text — every frame here too.
The full chain, tested
Recapping the pipeline: grab the fuel float from the other FSM, multiply it by 100, convert the float to a whole number, convert that number to a string, and set the on-screen text from the string. Hit play — the label reads 100, and as fuel burns the bar drains and the percentage falls in lockstep, then climbs back as fuel regenerates. Five actions, one state, and a slider that finally tells the player exactly what it means.





