4. Configure Our Game Mode

In the Content Browser, we will add a Blueprint Class based on our project's GameMode. This makes it possible to set the exposed variables on those two classes to whatever values we want. To do this:

Click the Add button in the Content Browser.

Pick HowTo_UMGGameMode as the parent class. It will be listed in the All Classes section.

Name the resulting Blueprint asset MenuGameMode.

In order to see our mouse cursor in-game, we'll need to create a Blueprint of the PlayerController as we did with our GameMode.

Click the Add button in the Content Browser again.

Select Player Controller from the Common Classes section.

Name the Blueprint MenuPlayerController.

Edit MenuPlayerController.

Check the Show Mouse Cursor box.

Edit MenuGameMode.

The Starting Widget Class must be set to the MainMenu asset in order to bring up our menu when the game begins.

The Default Pawn Class should be set to Pawn instead of DefaultPawn so that our player will not be able to fly around while in the menu.

The Player Controller Class should be set to the MenuPlayerController asset we created so that the mouse cursor will be shown in-game.

In order for our Blueprint to be used, we must return to the Level Editor window and change the World Settings for our current Level via the Settings button.

It is also possible to set the default GameMode in the Project Settings menu, under the Maps and Modes section. If you use this method, all of your levels will default to the GameMode you choose, unless overridden individually. Which method you use depends on how you prefer to set up your project.

The World Settings Panel will open up. By default, it will be docked with the Details Panel, but it can be moved elsewhere. We need to set the Game Mode Override field to our MenuGameMode asset.

Our custom GameMode asset is now in effect on our level, configured to load our Main Menu, and use our Player Controller that shows the mouse cursor. If we run the game now, our Quit button will work as expected, and our New Game button will take us to an empty menu screen. Our next step will be to set up the New Game menu.