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:

  1. 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

  1. 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).
  2. 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 you Print, for writing messages to the log.

hello_device := class(creative_device): — this defines a new kind of device.

  • hello_device is the name (snake_case — matches the file).
  • := means "define this as…".
  • class(creative_device) means "a class based on creative_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_device is 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.

  • OnBegin is the name UEFN looks for to run on startup.
  • <override> says "I'm replacing the empty default OnBegin with my own."
  • <suspends> means "this is allowed to run over time" (some game code waits for things — more on that later).
  • :void means 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.

  1. Back in UEFN, open the Verse menu and choose Build Verse Code (shortcut is usually Ctrl+Shift+B).
  2. 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

  1. After a successful build, your hello_device appears in the Content Browser (search for its name).
  2. Drag it into the level, like any other device.
  3. Click Launch Session to run your island.
  4. Open the Output Log (Window menu → Output Log) and look for Hello, Verse!

Print writes to the log, not the screen. The Output Log is where you'll watch your code "speak" while learning — get comfortable keeping it open.

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 — the using { /UnrealEngine.com/Temporary/Diagnostics } line got removed; put it back.

Official references:

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

  1. Multiple choice1 / 4
    What does basing your class on creative_device give you?
  2. Predict the output2 / 4
    This device runs when the island starts. What appears in the Output Log?
    hello_device := class(creative_device):
        OnBegin<override>()<suspends>:void=
            Print("Hello, Verse!")
  3. Spot the bug3 / 4
    This won't build. What's wrong?
    hello_device := class(creative_device):
        OnBegin<override>()<suspends>:void=
        Print("Hello!")
  4. Multiple choice4 / 4
    You wrote your Verse and saved the file. What must you do before UEFN can use the new device?