Welcome back everyone, time for us to start putting all the pieces together for our game and I want to start right in the beginning at our start menu. The goal of this video is to start off our game by presenting a start menu to the player. Now this is going to involve us creating a new start menu level, as well as a game mode blueprints specific to our start menu. Since our Start Menu level is not going to share the rules that our game itself will have. For example, we're going to want this level I'm using air quotes there to have its own music playing in the background, as well as to not show HUD on the screen. So this is how we're going to do it.
And this is a very common approach that games made an unreal use to launch a game. come under your file menu way up in the left hand portion of the level editor. We want to create a brand new level. And for this one, we want it to be an empty level. So go ahead and select that guy. And right away, let's click this Save button.
And it's going to ask us where do you want to save this. Let's save this to our first project levels folder. And I'm going to call this simply start menu and click Save right there. And now you can see with this tab right here, our level is named Start Menu. Now obviously, we can't see anything in this level. There's nothing here and that's okay.
This is sort of an empty level in which we are going to be going into when we first start up our project. And then from here, we are going to show our actual Start menu screen. And then on that screen, we're going to be able to click that level one button. To launch our game and actually transfer over to our level one level. Before we do any of that we need to create a new game mode blueprint. So let's come under our first project blueprints framework folder.
Note that path. Then let's right click in some empty space new blueprint class. And here we want to create not an actor blueprint, a game mode base blueprint. We're going to name this one BP underscore game mode underscore Start Menu. Okay, so with that created let's go ahead and double click on them to open it up. And currently in our viewport you see nothing which is fine.
We don't want to see anything yet, we want to hop on over to our Event Graph tab. And we need to script some functionality to actually make our start menu screen appear. And we're going to do this off of Event Begin Play this node, which is here by default. But if you don't see it, you can right click and search for it. I'm going to get rid of this Event Tick right below because that is not needed. Okay, I'm gonna do one thing off of our Event Begin Play here, I'm going to look for a sequence node.
And the reason I'm going to look for a sequence node is because upon beginning play, I want to do two things I want to Firstly, search for a Create Widget. We want to create a widget which widget do we want to create? Well, we created something called w BP Start Menu. Ah and then out of this route, Hearne value I want to drag out a wire and type in Add to Viewport. So what we are saying here is that when we begin play, we want to add our start menu screen to our view viewport. To accompany that, wouldn't it be nice if we had a little background music playing?
I think so. So Drag off of this then one pin. Let's search for a place down 2d. And here I'm going to slot in starter Music cue. This one is located within your star content, just a nice little song to play in the background. So with that, let's go ahead and Compile and Save.
And now let's go ahead and play let's see if we see see that start menu and lo and behold, we still see Our crosshair, we don't see a start menu at all. Huh? What could be the problem? Well, you may notice that we are creating this BP game mode Start Menu. That's the new game mode we just created. But we're not actually using this yet.
We are in our start menu here and we can actually override what the game mode is for this specific level. Remember, currently our project settings let me just bring that back on. maps and modes tab. Currently, our project settings determines that we are using this first person gain mode blueprints that's why when I click play there, I was seeing the first person have that crosshair appear in the center of the screen. Now I don't want to do that. That's why I created a new game or blueprint Start Menu.
Okay, so with my Start Menu selected here we are in our Start Menu level. You can find your world settings over on the right hand side. And if you don't see this particular tab, you can click it on by coming under window world settings. And if you look in your world settings there is a game mode override that is currently set to none. Because it is set to none, we are using our default game mode determined in the project settings are first person game mode. But here in your world settings, you can override what is going to be the game mode for this specific level.
I'm going to change this on over to my BP game mode Start Menu like so. And down below for my selected game mode. You can see my default pawn class is currently default pawn. My HUD class is currently set to HUD, my Player Controller is currently set to player control And this may be a little different than what you see in your project settings. For example, in your project settings when you have the first person game mode, slotted in your default pawn class is the first person character. Here we are overriding it with our BP game mode, start menu, and that is not the case.
These all got slotted in by default. And you can see if we double click on your BP Start Menu, if I was to go in my class default that is where all the settings come from. These are here by default. These are the exact same framework blueprints that you are seeing over here in your world settings when you slide in your BP game modes Start Menu. Okay, so now let's go ahead and try clicking play. And you will see that we now see our start menu which is all well and good but I click on level one and nothing is happening.
Now the reason nothing is happening yet is because we have not yet hooked up any functionality. So I'll just hit Escape to jump out of here. So now Where do I need to go to actually hook up our button for level one? When I click on that, how do I actually make it so I go into our level? Well, let's jump on over to our UI folder down here. And let's double click on our bps w BP Start Menu.
And up until this point, we've only worked in the Designer tab. Now let's work over in the Graph tab to hook up some functionality for this screen. Jumping on over to the Graph tab. We want to do something when we click on our level old one button. Over in the left hand side in the My Blueprint section, you can see you've got an A level one button and if you select that, down in the Details panel, there are several events that you can add to your graph. associated with that button.
We want to do something when we click on that button. So let's add an event for on click right here. that'll add that event to your Event Graph. And this is going to be a real simple script, simply drag on a wire and type in open level, there's a function to open a level. And it's gonna say what level name Well, if I jump back into our levels folder, our level name that we want to jump into is level underscore oh one, make sure you put it in exactly like that. In fact, I recommend clicking on it, doing f2 Ctrl C to copy that.
Then jump back to your web p Start menu. Select right here and then do Ctrl V to paste that so you don't make any mistakes. Make sure you Compile and Save. And now if you jump in and play You see your start menu here. And if you click on level one, you will be transported to level number one where you can begin playing. And now you see we've got our crosshair back on the screen because we are in a different level that is using a different game mode blueprints.
Okay, so that is all well and good. So we have a separate game mode in our start menu, then we do in level one, which is pretty cool, because in our start menu, our BP game mode Start Menu does not use the HUD class of First Person HUD. We don't want to see that crosshair. We don't want to be controlling a character at all either. We only want to be interacting with that screen. Now one more thing I want to point out here to you all and this is also in the project settings.
So hop back on over there. Here in your maps and modes section. You will see Right below all your framework blueprints right here, an option called default maps editor start up map and it says if set this map will be loaded when the editor starts up, and currently I've got it set to level one. Now, if you were to close out this project, this entire Unreal Engine, close it all out and then bring it back up, you would start on level one, well, let's change this on back to start menu, like so. And what this will do is, after we close out our Unreal Engine, the next time we open Unreal Engine backup, this will be the level that will be loaded up by default. So just know about that.
With that, I'm just going to do Ctrl Shift n S to save everything that I have just done. Guys, that is going to do it all for this one. We now have a functioning Start Menu. We'll see you guys in the next Video