The "No-Compile" Cheat Code: Making Verse Attributes Editable in UEFN
The "No-Compile" Cheat Code: Making Verse Attributes Editable in UEFN
So, you’ve written some Verse code. You’re feeling like a coding god. You tweak one tiny number—maybe the speed of your chaos button or the damage of your revenge trap—and hit Push.
Then, the inevitable happens. The compiler screams. You wait. You wait some more. You fix a syntax error. You push again.
Sound familiar? It’s the "Recompile Cycle," and it’s the enemy of creativity.
Today, we’re killing that cycle. We’re going to learn how to make your Verse devices behave like standard Creative devices. You know those devices where you can tweak the "Duration" or "Team ID" right in the editor without touching the code? That’s what we’re building. By the end of this, you’ll be able to adjust your island’s balance live, just by changing a number in the properties panel. No more waiting for the compiler to finish its coffee break.
What You'll Learn
- The "Editable" Superpower: How to tag your data so UEFN lets you tweak it in the editor.
- Class Attributes: What they are (spoiler: they’re just variables with extra responsibilities) and why you need them.
- The
@editableTag: The single most important line of code for your workflow. - Building a Live-Tweak Device: A practical example of a device whose settings you can change without recompiling.
How It Works
The Concept: Variables vs. Editable Properties
In programming, a variable is just a container for data. Think of it like a Loot Drop. The loot drop itself is the device (the code), but the type of loot it gives (Shotgun vs. Rocket Launcher) is the data inside.
Normally, if you want to change the loot drop from a Shotgun to a Rocket Launcher, you have to go into the code, change the text, and recompile. That’s like having to go to the bus, jump out, run back to the island, change the code, and run back to the bus just to switch weapons. It’s tedious.
Editable properties are like a Creative Device’s Settings Panel. When you place a "Prop Spawner" in the editor, you see a list of options on the right side: "Team ID," "Respawn Time," "Is Static." You can change those numbers instantly. The device doesn’t need to be rebuilt; it just reads those numbers when the game starts.
In Verse, we use a special tag (a keyword that modifies how code behaves) called @editable. When you put this tag in front of a variable inside your class, you’re telling UEFN: "Hey, don’t hide this variable in the code. Put it in the editor’s properties panel so I can tweak it without recompiling."
The Scene Graph Connection
In Unreal Engine, everything is part of the Scene Graph. Think of the Scene Graph as the Island Hierarchy. You have the Island, which contains Zones, which contain Devices, which contain Props.
A Class in Verse is like a Blueprint or a Template. If you have a "Chaos Button" device, the Verse code is the blueprint. The specific button you placed on your island is an Instance (a specific copy of that blueprint).
When you mark an attribute as @editable, you are making that attribute part of the Instance’s editable component. Just like you can change the color of one specific wall without changing the color of every other wall in the game, you can change the DamageAmount of one specific Verse device without changing the code for all devices.
Let's Build It
We’re going to build a "Revenge Trap" device. But instead of hard-coding the damage or the delay, we’re going to make those settings editable. This way, if the trap is too hard, you just drag the slider in the editor. No code changes. No recompiling.
The Code
Here is the Verse code for our editable Revenge Trap. Copy this into a new Verse Device in UEFN.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our "Blueprint" for the Revenge Trap.
# The <public> tag means this device can be placed in the world.
revenge_trap_device<public> := class<concrete>(creative_device):
# --- EDITABLE ATTRIBUTES ---
# These are the variables that will show up in the editor panel.
# The @editable tag is the magic sauce.
@editable
DamageAmount : float = 50.0 # Default damage, like a standard shotgun blast
@editable
TriggerDelay : float = 1.5 # Seconds before the trap goes off
@editable
TrapSound : string = "Explosion" # The sound effect to play
# --- GAME LOGIC ---
# This runs when the game starts.
OnBegin<override>()<suspends>: void =
# We grab the player who triggered the trap (we'll assume a trigger zone for simplicity)
# In a real scenario, you'd bind this to a specific trigger event.
# For this demo, we just log the settings to prove they are readable.
# This line prints to the debug console what the current settings are.
# You can change the values in the editor, push, and see this print change!
Print("Trap Settings Loaded: Damage = {DamageAmount}, Delay = {TriggerDelay}")
# This is a simple function to deal damage.
# It's not editable, because it's logic, not a setting.
DealDamage(target_player: player): void =
if (FortChar := target_player.GetFortCharacter[]):
FortChar.Damage(DamageAmount)```
### Walkthrough: What Just Happened?
1. **`class(concrete)`**: This defines our device. It’s a "concrete" class, meaning it’s a real, placeable object in the game world, not just an abstract idea.
2. **`@editable`**: This is the star of the show. Look at `DamageAmount`, `TriggerDelay`, and `TrapSound`. Because we put `@editable` right above them, UEFN knows to create input fields for these in the device’s properties panel.
3. **Default Values**: Notice `= 50.0` or `"Explosion"`. These are the **defaults**. If you place the device and don’t change anything, it uses these numbers. But because they are editable, you can change them *after* placement.
4. **`OnBegin`**: This function runs when the island starts. We added a `Print` statement here just to show you that the device is "reading" the values you set in the editor. If you change `DamageAmount` to `100.0` in the editor and hit "Push," the next time the game starts, it will print `Damage = 100.0`.
### How to Use It in UEFN
1. **Create the Device:** In UEFN, go to the **Verse** tab, create a new **Verse Device**, and paste the code above.
2. **Place It:** Drag your new `revenge_trap_device` into your island.
3. **Open Properties:** Click on the device in the viewport or the Outliner. Look at the **Properties** panel on the right.
4. **Edit:** You should see three new fields:
* **DamageAmount**
* **TriggerDelay**
* **TrapSound**
5. **Tweak:** Change `DamageAmount` to `100.0`. Change `TriggerDelay` to `0.5`.
6. **Push:** Hit Push. The game starts. Check the debug console (press `~` in-game). You’ll see the log message with your *new* values.
Boom. You just edited your game logic without writing a single new line of code.
## Try It Yourself
Now that you’ve got the basics, let’s make this device actually *do* something.
**The Challenge:**
Modify the `revenge_trap_device` to actually trigger after the `TriggerDelay` time.
1. Add a `Timer` variable to your class.
2. In `OnBegin`, start a timer that waits for `TriggerDelay` seconds.
3. When the timer finishes, call the `DealDamage` function (you’ll need to figure out how to get a target player—hint: look up how to bind to a "Trigger Zone" device in Verse, or just make it damage everyone in a radius for now).
**Hint:**
You’ll need to use `CreateTimer()` and a function that runs *after* the timer. The syntax looks like this:
```verse
CreateTimer(TriggerDelay, func(): void =
# Code to run after delay
)
Remember, TriggerDelay is now an editable property, so you can test different speeds instantly!
Recap
- Editable Properties are the bridge between your code and the editor. They let you tweak values without recompiling.
- Use the
@editabletag in front of any variable inside your Verse class that you want to expose in the UEFN properties panel. - This saves you from the "Recompile Cycle" and lets you balance your island like a pro designer, adjusting numbers on the fly.
Now go make some traps that are perfectly balanced (or perfectly broken, we don’t judge).
References
- https://dev.epicgames.com/community/snippets/zW2/fortnite-making-class-attributes-editable-in-uefn
- https://dev.epicgames.com/documentation/en-us/uefn/editing-components-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/editing-components-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/editable-properties-in-verse
- https://dev.epicgames.com/documentation/en-us/fortnite/realistic-assets-characters-and-environments-in-unreal-editor-for-fortnite
Verse source files
- 01-device.verse · device
- 02-fragment.verse · fragment
Turn this into a guided course
Add fortnite-making-class-attributes-editable-in-uefn 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.
References
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.