Gameplay, UI & Audio · Easy · 15 min
Build a Main Menu with a Play Button
Make a real main-menu screen in UMG: a Play button that loads your level, an Exit button that quits the game, and the mouse cursor working the way players expect.
Before this: Your First UMG Widget and HUD: Show Text, an Image and a Health Bar On Screen, What Is a Blueprint? Create Your First One (No Code Required)
- Build a main-menu widget with Play and Exit buttons in UMG
- Wire On Clicked events to Open Level and Quit Game
- Use Set Input Mode UI Only and Show Mouse Cursor so the menu is clickable
- Show the menu when the game starts from a dedicated menu level
Every game starts here
Press Play on almost any finished game and the first thing you see isn't gameplay — it's a menu. A title, a Play button, maybe an Options screen, and a way to quit. That front door is what turns a level into something that feels like a real game, and the good news is you can build a working one in about fifteen minutes.
A main menu in Unreal is just a UMG widget — the same kind of on-screen UI you met when you built a HUD — with a couple of buttons. The clever bit isn't the buttons themselves; it's the three small jobs we wire up behind them: load the game level, quit the application, and make sure the mouse actually clicks things. Let's build all three.
If a word like 'widget' or 'level' feels new, don't worry — we'll explain each one the first time it shows up. Tick off the steps as you go so you never lose your place.
Five words you'll use the whole lesson
Tap a card to flip it
Before you start
Tick these so the lesson flows without surprises:
- A project open in Unreal Engine 5.4 or newer (the Third Person template is perfect)
- You've made at least one simple UMG widget before, or you've done the HUD lesson
- A playable level you'd like the Play button to load (the template's default level is fine)
- Five minutes of quiet — the Input Mode step is the one place beginners get a 'dead' mouse, and we'll get it right
Build the menu and wire the buttons
Work top to bottom. Each row stays ticked even if you close the page and come back.
- 1Create the menu Widget Blueprint
In the Content Browser, right-click an empty space and choose User Interface, then Widget Blueprint. (In some 5.x versions you pick a 'User Widget' base — accept the default.) Name it something clear like WBP_MainMenu.
Double-click it to open the UMG editor. You'll see a Designer tab (the visual canvas) and, top-right, a Graph button that flips to the logic side.
TipPrefix UI widgets with WBP_ so they're instantly recognisable in a busy Content Browser later.
- 2Lay out a title and two buttons
On the Designer canvas, drag a Vertical Box from the Palette onto the screen — it stacks its children neatly. Into it, drag a Text widget for the title (type your game's name), then two Button widgets.
Drop a Text widget INSIDE each button and label them 'Play' and 'Exit'. A Button is just a clickable box; the text inside is what the player reads.
TipSelect a button and rename it in the top-left (e.g. PlayButton, ExitButton). Clear names make the next steps far easier to follow.
- 3Add the On Clicked event for Play
Select your Play button. In the Details panel on the right, scroll to the Events section and click the green '+' next to 'On Clicked'.
Unreal jumps you to the Graph and drops an 'On Clicked (PlayButton)' event node. This node fires the instant the player clicks that button — everything you wire to its output runs in response.
TipIf clicking '+' doesn't jump to the Graph, click the Graph button (top-right) yourself; the new event node is waiting there.
- 4Open the game level when Play is clicked
From the On Clicked node's white output pin, drag a wire into empty space and search for 'Open Level (by Name)'. Drop it.
In the node's 'Level Name' field, type the exact name of your playable level — just the level's name, not a file path (e.g. ThirdPersonMap). Open Level unloads the current level and loads that one, which is exactly how a Play button starts a game.
TipGet the level name exactly right, including capitalisation. Find it in the Content Browser; a typo here loads nothing and looks like a broken button.
- 5Add Exit and wire Quit Game
Back in the Designer, select the Exit button and add its 'On Clicked' event the same way. In the Graph you'll now have a second event node.
From the Exit button's On Clicked pin, drag out and search for 'Quit Game'. Drop it and leave its settings at the defaults. Quit Game cleanly closes the running game.
TipIn the editor, Quit Game ends Play-In-Editor (it stops the preview) rather than closing Unreal itself. It only closes a real, packaged build — that's the correct behaviour.
- 6Show the menu and switch to UI input
Open the Level Blueprint of your MENU level (Blueprints button on the toolbar, then 'Open Level Blueprint'). From the Event BeginPlay node, add 'Create Widget', set its Class to WBP_MainMenu, and connect 'Add to Viewport' after it so the menu appears on screen.
Then add 'Set Input Mode UI Only' (drag from a 'Get Player Controller' node into its Target), and add 'Set Show Mouse Cursor' with its tick-box enabled. Without these two, the player's mouse stays hidden and locked to the game, so the buttons look clickable but do nothing.
TipPass your menu widget into Set Input Mode UI Only's 'In Widget to Focus' pin (use the Create Widget node's Return Value). It keeps keyboard/controller focus on the menu, which matters for gamepad navigation later.
- 7Press Play and click your buttons
Make sure the menu level is the one open in the editor, then press Play. Your menu should appear with a visible mouse cursor.
Click Play — the game level should load. Restart and click Exit — Play-In-Editor stops. If both work, you've built a real main menu.
TipSet this menu level as the project's default map in Project Settings → Maps & Modes → 'Game Default Map' so a packaged build boots straight into your menu.
Shortcuts that speed up menu work
- Alt P Press Play (start Play-In-Editor) to test the menu
- Esc Stop Play-In-Editor and return to editing
- Ctrl S Save the current asset — save your widget and Level Blueprint often
- Ctrl W In the UMG Designer, duplicate the selected widget (handy for a third button)
- Home In a Blueprint graph, zoom to fit your nodes so you don't get lost
You click Play in the editor and the screen goes black or 'nothing happens'. The button name is right. What's the usual cause?
Check the Level Name you typed into Open Level. It must match a real level's name exactly (correct spelling and capitalisation) — Open Level (by Name) takes the level's NAME, not a file path. A mismatch loads nothing, which looks like a black screen or a frozen menu.
Open the Content Browser, find your playable level, and copy its exact name into the node. If you'd rather not rely on typing it, there's an 'Open Level (by Object Reference)' variant where you pick the level asset from a dropdown — no spelling to get wrong.
Two ways to point Open Level at your level
Open Level (by Name) takes a text Level Name. Quick to wire and the version you'll see in most tutorials.
The catch: it's just text, so a typo fails silently. Double-check the name against the Content Browser and mind the capitalisation.
Open Level (by Object Reference) lets you select the level asset from a dropdown instead of typing a name, so you can't misspell it.
Slightly more robust for beginners. Both nodes do the same job — swap the level you load with zero typing.
QuizCheck yourself
1Which event do you wire your menu logic to so it runs when a player clicks a button?
A Button fires On Clicked the moment it's clicked and released. That's the starting node for Play, Exit, and any other menu action.
2Your menu shows up but the buttons don't respond to clicks. The most likely fix is to…
By default the game hides the cursor and routes input to gameplay. Switching to UI Only input and showing the cursor lets clicks reach your buttons.
3What does the Play button's Open Level (by Name) node actually need?
Open Level (by Name) takes the level's NAME, not a path. It must match an existing level exactly — capitalisation included.
Add a third button to your menu labelled 'Quit to Desktop' that is visually separate from Play, and make absolutely sure your menu boots first when the game runs. Then confirm the Play button reliably loads your game level.
Hint 1
Duplicate your Exit button (select it and press Ctrl+W) so the styling matches, then relabel it.
Hint 2
For 'boots first', set the menu level as the Game Default Map in Project Settings → Maps & Modes.
Hint 3
Test by pressing Play, clicking Play to load the level, then re-running and clicking your new Quit button.
In the Designer, select the Exit button and press Ctrl+W to duplicate it; rename the copy (e.g. QuitDesktopButton) and set its text to 'Quit to Desktop'. Give it its own On Clicked event and wire it to Quit Game, exactly like Exit. Reorder it in the Vertical Box so it sits on its own.
Open Project Settings → Maps & Modes and set 'Game Default Map' (and optionally 'Editor Startup Map') to your menu level so a packaged build opens on the menu. Press Play: the menu appears, Play loads the game level via Open Level, and either quit button cleanly ends the session.
Mark this lesson complete
We'll remember it on your Academy page and unlock the next lesson below.
Questions beginners ask
Why does my Exit button do nothing in the editor?
It's working correctly. Quit Game closes a running, packaged build of your game. Inside the editor it ends Play-In-Editor (stops the preview) instead of closing Unreal. To truly see it quit the application, package the project and run the .exe.
Should the menu be its own level, or part of my game level?
For a clean start, make a small, near-empty 'menu level' whose only job is to show the menu widget, then use Open Level on the Play button to load your real game level. It keeps the menu logic tidy and means your game level isn't cluttered with UI startup code.
Where exactly do I create the menu widget — BeginPlay of which Blueprint?
The simplest place for a beginner is the Level Blueprint of the menu level: on Event BeginPlay, Create Widget, Add to Viewport, then set UI-only input and show the cursor. As your project grows you'll usually move this into a HUD or Game Mode class, but the Level Blueprint is perfectly fine to learn with.
My mouse cursor still won't show even after Set Show Mouse Cursor — why?
Make sure you're calling it on the correct Player Controller (drag from a Get Player Controller node into the Target pin) and that the call actually runs on BeginPlay. Also confirm you enabled the tick-box on Set Show Mouse Cursor — left unticked, it hides the cursor instead of showing it.