How To Create A Pause Menu - Unreal Engine 5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you are playing your game but you need to take a league or do other important things you want to pass your game you hit p on your keyboard so you can't pay yourself and then you can hit continue to continue the game or you can hit p again to continue once more or pause and hit quit we'll create a menu just like this one i'll show you the logic and how to create this the first thing we will need to do is to create a widget blueprint to keep things organized right click and create a folder call it ui of user interface open this one up right click user interface and a widget blueprint let's call this one the pass menu open that one up and dock it in here so we can easily switch in between ok let's start with the text and drag in your text and hearing content let's name this game past so our player sees that our game is passed here under appearance in font you can increase the font and then scale up as you need to and let's anchor this here to the screen like this good now we will need a button so drag in a button let's make the button a bit bigger like this anchor it right there for example and let's drag a text on top of this button let's name this con continue and let's also increase the font of this button so we can see it really good okay click the button once more and let's give it as a name for example continue so later on we can see that we can work on this button then click here ctrl w to continue this one and let's name this quits because i want to make a quit button and the text here let's change the text to quit okay let's align these a bit and place this anchor right there okay so this is very simple pause screen but you can just tweak this as you like let's add some logic to this first of all hit the button not the text but the button itself then go to unclicked event and click this one the first thing we want to do is to set the input of our game mode unclicked so right click then get player controller then drag out of this set input gamemode only so when we continue is back into our game we no longer want to ui here then also drag from this value set show mouse cursor we don't need the mouse cursor anymore so leave this empty then drag of this remove from parent this makes sure our screen that we just made here is removed from our screen so remove from parent target itself so this is the thing itself and then set game past click this one and keep it unchecked because when we hit the continue button we don't want the game to be passed okay now back to designer hit your quit button remember to click on the button itself and then unclicked this one is easy there's a function relational reel namely quit gain and hit compile now another thing you can do is to go back here and look from blur background blur drag this here on the pause menu canvas panel so you have your background blur for example let's anchor this ctrl click to full screen then look from blur and the blur strength let's set it to something like 2 or three maybe let's see this is blurry okay this is what i want now i can drag this more on top of here so my game is boot and not my screen so make sure this is above these other ones so my game is a bit blurred this happens most games when you pass your game okay great so to go back to our logic we have our logic enabled let's also get our menu on our screen how do we do that so here in content go to third person blueprint blueprints and then you have your third person character or click it right there good in the event graph we need to add an event how do we do that go to edit project settings and under engine there's input and let's create a new action mapping hit the plus icon and let's name this one pause the input for this hits the p for the p key not on the gamepad but here on the keyboard p you can add more if you like i just use the p key for pausing my game okay and now when i go back here in the event graph of my third person character right click then you can see the action that we just created namely pass okay first thing we have to do when this is selected is execute when passed most things are passed when the game is passed of course but we don't want this pass because this needs to work while our game's pass so click this box then on pressed we will create a flip flop and it sounds funny but it's actually very convenient namely it first executes a and then b so we can do opposite motions of each other let's start with the a the thing it will do first so let's create a widget and the widget is the widget we just created namely the pass menu okay great then from this return value let's add this to the viewport namely the screen that our player sees now what you're going to do is to set game passed but this time we check the box we want our game to be passed then right click get our player controller once more because we need some more options for this name set inputs modes to gaming ui let's connect these up as well and also drag from this once more set show mouse cursor and then hit this one up and we want to see our mouse cursor because then we can click on our menu okay great so once more while we hit the p key or action it'll go to a first it will create the menu that we just created right here on our screen then we'll add this to the viewport so we can see it it will pause the game then it will set input mode to game and ui so we can interact with the ui and we see our mouse cursor now when you hit this key again it flip stops to b because then we want our game to continue playing and what we then want to do is to remove this from the screen and unpause our game so from this return value type in remove from parent because this removes this widget from our screen and connect this one up with b so right now we can just follow along once more right click get player controller we can use this one here as well but this is more organized like this then set input mode to game only because when the game is on past i only want to be playing again drag from here once more set show mouse cursor during the game i don't want to see the mouse cursor so leave this as this and then set game passed and keep this one unchecked because we don't want our game passed because then we want to play our game once more okay let's just let's test this one out make sure this is compiled this is compiled then hit play okay you can walk around in your game good everything works then i hit the p key okay we see our menu hit p again see and this is called unlock screen i have my blur effect i can also click continue and continue playing this game okay and the input works i can do this again okay and i can also quit the game to quit the game so i hope this helped and you can make your pass game from your game right now [Music] [Music]
Info
Channel: Buvesa Game Development
Views: 21,997
Rating: undefined out of 5
Keywords:
Id: voIMzFOQEOs
Channel Id: undefined
Length: 9min 4sec (544 seconds)
Published: Wed Jan 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.