-

How To Create A Menu (Main & Pause Menu) Unreal Engine 4

Learn How To Create A Menu (Main & Pause Menu) Unreal Engine 4 - Here you will learn how to create a simple Main Menu and Pause Menu for your game in Unreal Engine 4. For this tutorials to work you need to select the Third Person Project with Starter Content.

How To Create A Simple Main Menu

First, create a new empty level, go to Content Browser > click RMB (right mouse button) > under Create Basic Asset select Level > for example purposes, let's call it SimpleMenuLevel.

Second step, create a new Widget Blueprint, go to Content Browser > click RMB > under User Interface select Widget Blueprint > for example purposes, let's call it SimpleMenu.

Now, open the SimpleMenu Widget Blueprint, drag from Palette a Border into Hierarchy > Canvas Panel, go to Details panel, in the Slot section next to Anchors select the full page Anchor, next to Position X type 0 - next to Position Y type 0 - next to Size X 0 - next to Size Y 0, under Appearance > Brush > double click the Tint bar > in the Hex sRGB type 000000FF

Next, drag from Palette two buttons into Hierarchy > Canvas Panel, for each button drag from Palette a Text, select the first Text, go to the Details panel into the Content section next to Text, erase Text Block and write Play, select the second Text, go to the Details panel into the Content section next to Text, erase Text Block and write Quit.

Select the first button, go to Details panel, next to Position X type 800 - next to Position Y type 300 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1, select the second button, go to Details panel, next to Position X type 800 - next to Position Y type 500 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1.

Select both buttons, go to Details panel, under Appearance > Style > Normal > double click the Tint bar > in the Hex sRGB type 6B6B6BFF - do the same for Style > Hovered and Style > Pressed.

Now, we have the visual part, let's start scripting our simple Menu.

Scripting The Main Menu

Select the first button, go to the Details panel, under Events section > click LMB on the green button next to On Clicked, you will be transferred in the Graph editor, were you will see your newly created event, from here go in the right corner up and select Designer, this way you will be switch back to the Blueprint Designer Mode, were you will need to select the second button and perform the same steps as for the first one.

Now, in the Graph editing mode select the event for the first button and add an OpenLevel node, set it to ThirdPersonExampleMap, then, add a Remove from Parent node at the end, select the event for the second button and add an Execute Console Command node set the command to quit - Compile and Save, then close the Widget Blueprint.

In the Content Browser select and open your newly created level, called SimpleMenuLevel, after you have open the level, go in the Toolbar panel > Blueprints > Open Level Blueprint, right-click in the graph and add an Event Begin Play node and connect a Create Widget (set Class to SimpleMenu), connect an Add to Viewport node, add a Get Player Controller node, off it add the Set Show Mouse Cursor node set to True, Compile and Save, then close the Blueprint.

Next, you need to make the menu level the default map, go to Edit > Project Settings > Maps & Modes > Default Maps > replace the Editor Startup Map and Game Default Map with your menu level.

Congratulations! You have created A Simple Main Menu in Unreal Engine 4

How To Create A Simple Pause Menu

Create a new Widget Blueprint, go to Content Browser > click RMB > under User Interface select Widget Blueprint > for example purposes, let's call it SimplePauseMenu.

Now, open the SimplePauseMenu Widget Blueprint, drag from Palette two buttons into Hierarchy > Canvas Panel, for each button drag from Palette a Text, select the first Text, go to the Details panel into the Content section next to Text erase Text Block and write Resume Play, select the second Text, go to the Details panel into the Content section next to Text erase Text Block and write Quit To Menu.

Select the first button, go to Details panel, next to Position X type 800 - next to Position Y type 300 - next to Size X 300 - next to Size Y 100, select the second button, go to Details panel, next to Position X type 800 - next to Position Y type 500 - next to Size X 300 - next to Size Y 100.

Select both buttons, go to Details panel, under Appearance > Style > Normal > double click the Tint bar > in the Hex sRGB type 6B6B6BFF - do the same for Style > Hovered and Style > Pressed.

Now, we have the visual part, let's start scripting our simple Pause Menu.

Scripting The Pause Menu

Select the first button, go to the Details panel, under Events section > click LMB on the green button next to On Clicked, you will be transferred in the Graph editor, were you will see your newly created event, from here go in the right corner up and select Designer, this way you will be switch back to the Blueprint Designer Mode, were you will need to select the second button and perform the same steps as for the first one.

Now, in the Graph editing mode between the two newly created events add a Get Player Controller node, off the Get Player Controller, use Set Input Mode Game Only, drag again off the Get Player Controller and use Set Show Mouse Cursor and set it to False, then Remove from Parent and Set Game Paused, the entire string of nodes connect it to your Resume Play button event.

For the Quit To Menu button event, off the Get Player Controller use the Set Show Mouse Cursor node set to True, then add an Open Level node set to SimpleMenuLevel (or the name of the Level that you have your Main Menu on)

If you have a HUD, before adding an Open Level node you need to create a function to remove the HUD, to do that, in the left panel My Blueprint, go to the Functions section, create a new Function called Remove HUD by pressing the +Functions button, in this new function, add a Get Player Character node and off the Return Value, add the Cast To ThirdPersonCharacter node, off the As Third Person Character, use Get HUD Reference (you need to use a HUD reference from your main character Blueprint) then Remove from Parent.

Now, go to Content Browser > ThirdPersonBP > select and open Third Person Character > in the Graph, add a P Key Event and a Create Widget node (set to SimplePauseMenu) and promote the Return Value to a variable, drag and Get the new variable connect it to an IsValid node, connect the Is Not Valid pin to the Create SimplePauseMenu_C Widget, right-click and add the Get Player Controller node, then Set Show Mouse Cursor and set it to True, drag from the Get Player Controller node again, Get Player Controller Set Input Mode UI Only and connect the nodes, off the Pause Menu Reference variable, use the Add to Viewport node, then Set Game Paused (set Paused to True), Compile and Save.

Congratulations! You have created A Simple Pause Menu in Unreal Engine 4 - If you want to create a HUD for your character here is a link to do that How To Create A HUD Unreal Engine 4 - on this page you will also learn how to make an on screen Pause button.

UI Widgets Locking Aspect Ratio - Scale UI Widgets for Different Devices

Select the Canvas Panel in your UI Widget click RMB > Wrap With ... > select Scale Box, then, repeat and select the Size Box. Now, for the Scale Box details, change only Stretching > Stretch > Scale To Fill, and for the Size Box details, go to Child Layout > change the Width Override and the Height Override, I usually use for my widgets a Width Override of 1920 and a Height Override of 1080.

Interesting articles to read on Edvog.com
Unreal Engine 4 Beginner's Guide
Unreal Engine 4 Tutorials & How To's (With Pictures & Video)
Blender 3D Beginner's Guide
GIMP Beginner's Guide

- - - - - - - - - - - -

About Edvog.com - Music, Games & Educational Resources (Information, Health, Medicine & Research) by Edvog.com

My name is Andrei Ionita, I am the creator and owner of Edvog.com website, I am also the creator and owner of all of the products associated with it, such as: music, games, videos and more...

I like to write articles about everything I find interesting in this world. The entire content found on this website is fact checked and original, when I post something, I try to double check all the information provided against all the reliable and trustworthy sources that I can find. On this website you may find content about medicine, the purpose of this type of content is simply informational and is not intended to be a substitute for professional medical advice, for questions you may have regarding your health, always seek the guidance of your doctor or other qualified health professional.

About entertainment and media - Beside, being a website owner and content writer, I'm also a game developer, music producer and video creator. I create, video games, music, animations, photos and more, this is why, from time to time, I will also post content about entertainment and media industry (a broad terminology, just to cover everything in the category)

You can check out the games made by me on Steam and on Google Play, if want to listen my music you can check out my Youtube channel, Spotify profile, iTunes profile, Google Play Music profile, etc. Who knows? Maybe your next favorite game or song will be created by me :)

If you want to support my work, you can play the games created by me, listen to my music and/or Make A PayPal Donation, whatever form of support you will choose, I thank you and wish you a nice day!

Edvog.com / AI Edvog / Andrei Ionita on the internet

YoutubeSpotifyApple MusicAmazon MusicGoogle Play MusicGoogle PlaySteamSupport My Work Make A PayPal Donation

Comments