top of page

How To Create A Pause Menu in Unreal Engine 5?

Updated: Feb 2

The pause menu is a vital feature that allows players to temporarily halt the game, access various options, and seamlessly resume their gaming experience. In this step-by-step guide, we will explore how to design a simple pause menu using Unreal Engine's powerful UI tools and implement the necessary logic to pause and un-pause your game effortlessly. Whether you're developing a complex open-world adventure or a simple mobile game, mastering the creation of a pause menu is a fundamental skill that enhances the player's experience and adds polish to your project.

 


Pause menu

Table Of Contents


Step 1: Creating A Widget Blueprint


  • First, open your third person project template in which you want to create a pause menu in.

  • After that, go to the blueprints folder and right-click in the content browser.

  • In the drop-down menu, go to the “User Interface” tab and create a new “Widget Blueprint” for your pause menu.

creating a widget bliueprint unreal engine 5

  • Open the Widget Blueprint and first add a “Background blur” from the search tab then add a “Canvas panel” as well. Adjust the background blur option to make the background blurry as to give the illusion of the game being paused.

background blue unreal engine

  • Next, add “button” from the palette menu to the UI canvas. Duplicate the button by right-clicking and selecting duplicate, and then drag text inside, naming them "Resume" and "Quit”.

button unreal engine

  • Add another text box from the palette menu and name it “Paused” as a final touch to the UI menu.

pause menu unreal engine

  • Compile and Save this to move on to the next step.


Step 2: Adding Logic to the Buttons


Nodes to be used:

  1. Select Input Mode Game Only

  2. Get Player Controller

  3. Set Show Mouse Cursor

  4. Remove from Parent

  5. Set Game Paused

  6. Quit game


Steps:


After the UI is done, the next step is to add functions to the buttons of the menu.


Resume button:

  • To do this select the “Resume” button first and scroll all the way through its “Details” menu. Here, in the “Events” menu select the “On Clicked” event for the resume button.

details panel unreal engine

  • This will bring up the blueprint editor where the logic for the buttons will be setup.

  • Here, you need to drag a “Get Player Controller” node and connect it to the “Select Input Mode Game Only” node as well as the “Set Show Mouse Cursor” node.

  • Next, take a “Remove from Parent” node and connect it to a “Set Game Paused” node. This will remove the pause menu widget from the display and pause the game.

unreal engine blueprints

Quit button:


  • Setting up the “Quit” button functionality is quite straightforward.

  • For this, first go to the “On Clicked” event of the quit button.

  • Now, search for a “Quit game” node and connect it to the “On Clicked (ExitBtn)” node of the exit button.

quit button unreal engine

Step 3: Setting up the Third Person Character


Nodes to be used:

  1. Flip Flop

  2. Create Pause Menu Widget

  3. Add to Viewport

  4. Set Game Paused

  5. Get Player Controller

  6. Set Input Mode Game and UI

  7. Set Show Mouse Cursor

  8. Remove from Parent

  9. Set Input Mode Game Only

Steps:


  • This is the main part of the tutorial where the Pause Menu logic is setup in the blueprint of the character. To do this, first go to the “Third Person Character” blueprint from the content browser.

  • Double click to open it and right-click to choose an input key. For this, I will use the “P key” node as the starting node. A “Flip Flop” node will be used here to execute two functions one after the other. It has two nodes, A and B which will both execute different logic.


actions unreal engine

“A” node execution:


  • Take a “Flip Flop” node and drag a “Create Widget” node from its “A” node. Set the “Create Widget” node to the “Pause Menu” widget we created before.

  • After this, drag an “Add to Viewport” node from “Create Widget” node and then connect it with a “Set Game Paused” node with its Boolean value as true.

set game paused unreal engine

  • The next step is to take a “Get Player Controller” node and drag a “Set Input Mode Game Only” node as well as a “Set Show Mouse Cursor” node from this and connect them all with each other. Make sure the Boolean for the “Show mouse cursor” node is set as true.

show mouse cusot unreal engine


“B” node execution:


  • Now, drag a “Remove from Parent” node from the Pause Menu Widget node and then connect it with the “B” node of the “Flip Flop” node.

remove from parent unreal engine

  • Then take a “Set Input Mode Game Only” node and connect it with a “Set Player Controller” node and “Set Show Mouse Cursor” node.

set input game only unreal engine

show mouse cusor unreal engine

  • After all that’s done, connect a “Set Game Paused” node at the end.

set game paused unreal engine

  • Note that both of the Boolean values for the “Set Game Paused” and “Set Show Mouse Cursor” node will be set to false here.





Conclusion


  • Congratulations! You have implemented a simple Pause Menu in your game. Now, test your pause menu thoroughly to ensure that it pauses and resumes the game as expected.

  • Use print statements or debugging tools to track the execution of events and functions during pause and resume actions to track down errors or bugs in case any appear during testing.

  • To get notified of upcoming posts on Unreal Engine, I invite you to subscribe to our newsletter:




And if you are just getting started learning Unreal Engine, have a look at the Unreal Engine for Beginners Course :

978 views0 comments

תגובות


bottom of page