Your first Verse device
In Module 0 you placed pre-made devices by dragging them in. Now you'll make your own device — one whose behavior you write, in Verse. By the end of this lesson it'll print "Hello, Verse!" when your island starts.
Have UEFN open with a project loaded (any project from Module 0 is fine).
What we're building
A Verse device is just a device — like the ones in the Content Drawer — except its behavior comes from a Verse file you write. The recipe is always the same:
- Create a Verse file → 2. Write code → 3. Build it → 4. Drop the device in your level → 5. Run and see it work.
Let's do it once, slowly.
Step 1 — Create a Verse file
- In UEFN's top menu, open the Verse menu and choose to create a new Verse file (often Verse → Verse Explorer, then a + / "Create new Verse file" option).
- Name it
hello_device.
Naming rule: Verse file and device names use snake_case — all lowercase, words joined by underscores, like
hello_device. You'll see why this matters in a moment.
UEFN generates a starter file and opens it in a code editor (Visual Studio Code). It looks roughly like this:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A Verse-authored creative device that can be placed in your level
hello_device := class(creative_device):
# This runs once when the device starts in a running game
OnBegin<override>()<suspends>:void=
Print("Hello, world!")
Don't panic — we'll read every line.
Step 2 — Read every line
The using lines at the top bring in tools other people already wrote, so you don't have to. Think of them like "import these toolboxes":
/Fortnite.com/Devices— the device building blocks (this is what makes it a device)./UnrealEngine.com/Temporary/Diagnostics— gives youPrint, for writing messages to the log.
hello_device := class(creative_device): — this defines a new kind of device.
hello_deviceis the name (snake_case — matches the file).:=means "define this as…".class(creative_device)means "a class based oncreative_device" — i.e. it is a creative device, and gets everything a device can do for free.- The
:at the end opens a block; everything indented under it belongs to this device.
creative_deviceis the built-in starting point for any Verse device. Building on it is why your code can be placed in a level and react to the game.
OnBegin<override>()<suspends>:void= — a function (a named chunk of behavior) that runs automatically when the game starts.
OnBeginis the name UEFN looks for to run on startup.<override>says "I'm replacing the empty defaultOnBeginwith my own."<suspends>means "this is allowed to run over time" (some game code waits for things — more on that later).:voidmeans it doesn't hand back a value; it just does something.=opens the function's body — the indented lines below it.
Print("Hello, world!") — calls the Print tool and hands it a piece of text (a string, always in double quotes). That text goes to UEFN's log.
Indentation matters in Verse. Like a bulleted outline, indented lines belong to the line above. Use the editor's auto-indent and stay consistent — misaligned code won't build.
Step 3 — Make it yours
Change the message:
Print("Hello, Verse!")
Save the file (Ctrl+S).
Step 4 — Build the Verse code
Code has to be built (translated into something the game can run) before UEFN sees it.
- Back in UEFN, open the Verse menu and choose Build Verse Code (shortcut is usually Ctrl+Shift+B).
- Watch for a "Build succeeded" message. If it fails, it'll point at a line — most first-time failures are indentation or a missing quote.
Step 5 — Place your device and run it
- After a successful build, your
hello_deviceappears in the Content Browser (search for its name). - Drag it into the level, like any other device.
- Click Launch Session to run your island.
- Open the Output Log (Window menu → Output Log) and look for Hello, Verse!
If the build fails
- "Expected indentation" / unexpected indent — your lines aren't lined up. Match the template exactly.
- Unterminated string — you're missing a closing
". - Unknown identifier
Print— theusing { /UnrealEngine.com/Temporary/Diagnostics }line got removed; put it back.
Official references:
- Create your first Verse device: https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse
Printand debugging: https://dev.epicgames.com/documentation/en-us/uefn/print-in-verse
Saw "Hello, Verse!" in the log? That's your first program. Mark complete — next we'll make values we can name and reuse.
Check your understanding
- Multiple choice1 / 4What does basing your class on
creative_devicegive you? - Predict the output2 / 4This device runs when the island starts. What appears in the Output Log?
hello_device := class(creative_device): OnBegin<override>()<suspends>:void= Print("Hello, Verse!") - Spot the bug3 / 4This won't build. What's wrong?
hello_device := class(creative_device): OnBegin<override>()<suspends>:void= Print("Hello!") - Multiple choice4 / 4You wrote your Verse and saved the file. What must you do before UEFN can use the new device?