Build Your Own LEGO Island: Grid Placement in UEFN
Unverified — this example may not compile as-is.
The Verse code below did not pass our automated compile check, so it isn't marked verified and is hidden from the guide listing. The explanation may still be useful, but treat the code as a draft and adapt it before use.
Build Your Own LEGO Island: Grid Placement in UEFN
Welcome, builders! Have you ever played a LEGO game and loved placing bricks to build your own world? In Fortnite Creative, you can let players do the same thing. We are going to build a LEGO-style placement system.
You will learn how to set up a grid. Players will pick a prop. They will place it on the ground. It will snap to perfect spots. It looks like magic. But it is just good coding! Let’s build this together.
What You'll Learn
- What a Grid Entity is.
- How to use the LEGO Grid Entity Manager.
- How to define Plot Definitions.
- How to connect props to the grid.
How It Works
Imagine you are playing with real LEGO bricks. You have a baseplate. You only place bricks on the little bumps. You cannot put a brick in thin air. You also know which bricks are in your box.
Our system works the same way.
First, we need a Manager. Think of this as the box that holds all your available bricks. In Verse, we call this the LEGO Grid Entity Manager. It keeps track of which props players can use. It also knows which props are unlocked.
Next, we need a Grid. This is the invisible floor. It tells the game where it is okay to place things. It snaps props into neat rows and columns.
Finally, we need Plots. These are special zones. A plot says, "Only trees go here." Or, "Only flowers go here." This keeps your island tidy. It makes your game look professional.
Let's Build It
We will build a simple system. We will create a Manager. We will add one prop. We will make a plot for it.
Here is the Verse code for the Manager. This code sets up the "box" of bricks.
# This is our main script for the LEGO Grid
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
# We create a new device called BrickBox
# This device will hold our list of props
BrickBox := class(global) (VerseDevice):
# This is a list of things players can place
# We call these "Grid Entities"
GridEntities := []GridEntity
# When the game starts, we add our first prop
OnBegin<override>()<suspends>:void=
# Add a simple tree prop to the list
# Replace "Tree" with your actual prop name
GridEntities := Append(GridEntities, Tree)
# This function lets the game know
# which props are available
GetAvailableProps<override>()<override>:[]GridEntity=
return GridEntities
Breaking Down the Code
Let’s look at what each part does.
1. The using statements.
These lines bring in tools from Fortnite and Verse. They are like opening your toolbox.
2. class(global) (VerseDevice).
This creates a new type of device. It is a special container. It lives in the world.
3. GridEntities.
This is a list. A list is like a shopping list. It holds many items. Here, it holds the props players can place.
4. OnBegin.
This function runs when the level starts. It adds the tree to our list. Now the player knows the tree is available.
5. GetAvailableProps.
This tells the UI (the screen) what to show. It returns our list of props.
Setting Up the Devices in Editor
Code is only half the work. You must set up the devices in Unreal Editor for Fortnite (UEFN).
-
Add the Manager. Search for "LEGO Grid Entity Manager" in the device browser. Place it in your world. It can be anywhere. It is invisible.
-
Add the Prop. Place a tree prop in your world. This is the object players will place.
-
Configure the Manager. Click the Manager device. Look for the "Grid Entities" slot. Drag your tree prop into this slot. Now the Manager knows about the tree.
-
Create a Plot. Add a "LEGO Grid Plot" device. This defines the area. Set its size. This is where players can place the tree.
-
Connect Them. Link the Manager to the Plot. This tells the Plot which props it accepts.
Now, when a player selects the tree, it will snap to the grid!
Try It Yourself
You have the basics. Now, make it your own.
Challenge: Add a second prop. Maybe a flower or a bench.
Hint:
- Place your new prop in the world.
- Go back to your BrickBox code.
- Add the new prop to the
GridEntitieslist. - Add the new prop to the Manager device in UEFN.
- Test it! Can you place both items?
If you get stuck, check the device settings. Make sure the prop names match exactly.
Recap
You built a LEGO placement system. You used a Manager to hold props. You used a Grid to snap them. You used Plots to define areas. This is a powerful tool for creative islands. Keep building!
References
- https://dev.epicgames.com/documentation/en-us/fortnite/creating-a-lego-grid-placement-system-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/lego-bloom-tycoon-in-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/configuring-lego-prop-placement-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/setting-up-the-lego-grid-entity-manager-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/lego-bloom-tycoon-levels-and-devices-in-unreal-editor-for-fortnite
Verse source files
- 01-standalone.verse · standalone
Turn this into a guided course
Add creating-a-lego-grid-placement-system-in-unreal-editor-for-fortnite 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.