Download

Where do I have to put the code to display the main menu of my game?

I’ve just started to learn Unreal Engine and I developing a Pong game using C++.

To create the menu I have used UMG and to learn how to do it, I have watched Wiring up the Main Menu tutorial from Unreal Engine Online learning.

To show the Widget with the menu the instructor has created a new empty level and he has used Level Blueprint to
show it. But the instructor said: “Traditionally, you don’t use the level Blueprint for much”.

So, if we don’t have to use the level Blueprint, what do I have to do to display the main menu?

When having a dedicated Main Menu Level it makes sense to put it in the Level BP.
What they meant was that usually there’s not a lot of use for Level Blueprints as logic should be split into individual classes to be reusable, which level blueprints are not.

1 Like

Thanks for your answer but… is there another place where I can put the code to show the main menu?

I’m learning and I would like to know if there are another places to put that code.

Thanks!

Absolutely!
The Player Controller is a common place to have in-game menus but there’s nothing preventing you from handling your main menu there as well.
Generally it’s more a question of “When does the instance exist”.
When starting your game the player will load the main menu level and therefore it makes sense to just implement it there. Once the level is unloaded the main menu goes with it.
The player controller however might be a completely different one from the one you use in the menu or between game modes/different levels.

1 Like