Add a Main Menu - User Interface for Unreal 5.5 New Series - UE5 UI

Опубликовано: 16 Август 2026
на канале: ProfMoto
835
19

Adding a Main Menu to your game to allow, Play, Retry (Restart) and Quit.
Introduces ideas of Widget Blueprints and Create Widgets and Add to Viewport
Also covers Set Game Pause and Set Show Mouse Cursor.

Written Commands:
Canvas Panel is the best setting for an initial UI.
It allows absolute freedom on positioning elements, but does not scale as well as other Panels
Borders can be used with a single entity inside of them to create a progress bar with border
Margins in Progress bars need to be turned off for best visibility
Background image for Progress bar can be None for best appearance
An image, even a blank square, should be used for the Fill image to make it solid all the way

Creating a Main Menu:
Right click in Content Browser and Create UI - Widget Blueprint
Select User Widget
Rename to WBP_Menu
Open WBP_Menu
Create Panel - Canvas Panel by dragging Canvas Panel into Hierarchy or Viewport
Create Common - Button
Can now position with Anchor and can set anchor as Center, Center
( Center, Center Anchor, -60, -15, width 120, height 30 )
Create Text, place over button and display ‘retry’
( Center, Center Anchor, -50, -18, width 100, height 30 & Center Justified )

Create second button
( Center, Center Anchor, -60, 50, width 120, height 30 )
Create Text, place over button and display ‘quit’
( Center, Center Anchor, -50, 48, width 100, height 30 & Center Justified )

Create third button
( Center, Center Anchor, -60, -80, width 120, height 30 )
Create Text, place over button and display ‘play’
( Center, Center Anchor, -50, -83, width 100, height 30 & Center Justified )

Rename Buttons
Scroll down to ‘On Clicked’ and hit + for each of these (on button)
(set up appearance, hover and pressed)

Button 0 is restart (or better yet, rename as above)
Button 1 is quit(or better yet, rename as above)
Button 2 is play(or better yet, rename as above)


Quit Button on Clicked - Quit Game
Get Player Controller - Quit Game Specific Player

Restart Button can use Open Level (by name) which will reload the level
Add Set Input Mode Game Only
Player Controller will be Get Player Controller
Add Set Show Mouse Cursor to checked

Button 0 needs to turn off the interface and reclaim the mouse
We will set up a few other areas before we come back to set this one up.

Show that Text is getting in the way, change textblocks to visible: “Not Hit-Testable in Behavior

Enhanced Input (5.1 and later):
Navigate to your FirstPerson or ThirdPerson folder
Navigate to your Input - Actions folder
Right click and create a new Input - Input Action
Rename to IA_Menu
Open IA_Menu
Add Triggers and change to type Pressed
Set Trigger when Paused to True (I’ll skip this to show the issue and fix it later)
Open Player Character
Right click and IA_Menu of type Create Enhanced Action Event
Open Input folder inside your FirstPerson or ThirdPerson folder.
Edit your IMC_Default
Add keyboard input (suggest TAB for testing, ESC for publish?)
Save

Old Input for before 5.1:
Open Project Settings - Input - Action Mappings
Add Menu (Keyboard Esc and/or Tab and/or Gamepad Special Right) (Esc doesn’t work in Editor)

Open Player Blueprint (assume Third Person for these commands)
InputAction IA_Menu (Action Mapping we just created)
Right click elsewhere and create Custom Event, name it MenuCall
Drag off IA_Menu and call MenuCall
Drag off original Custom Event MenuCall to add Create Widget
Set Class to BP_Menu
Drag off return value and prompt to variable and name Main Menu
Connect pins to Set BP_Menu
Pull off pins to Add to Viewport
Connect Target
Pull off pin for Set Input Mode Game and UI
Target is Get Player Controller
Connect Main Menu to In Widget to Focus
Drag off Pin & Create Set Show Mouse Cursor (set to true)
Target is Get Player Controller

To Add On/Off Functionality:
Add Get Main Menu near Input Action Menu
Right click and Convert to Validated Get
InputAction Menu pins to Validated Get
Is Not Valid pins to Create BP_Menu Widget
Is Valid pull off to Remove from Parent
Target is Main Menu
Pull off pin and Set Main Menu, leave unchanged wipes Main Menu
Set Input Mode Game Only
Target is Player Controller
Set Show Mouse Cursor off
Target is Player Controller

Now that everything is working, we can go back to add the ‘Play’ functionality
Back in BP_Menu
Drag off On Clicked PlayButton to add Cast to BP_ThirdPersonCharacter
Set the object to Get Player Character
Drag off As BP Third Person Character to add MenuCall
Connect other pin