How do I change the GameMode through Blueprints?

When I load the next level in my game, I need the GameMode to change so that the correct controls and HUD are being used. How do I do this in a blueprint? Currently when a UI button i made is clicked I would like this transition to happen.

Event Receive Hit Box Click → Switch on Name ->Open Level → ??(change game mode)??

1 Like

Hi Demonicated,

You can specify which GameMode is being used for each level through the World Settings under Game Mode. When you change levels, you can assign a different GameMode, Controller, etc in that level.

For example, below I have a level called GameMenu where I use Menu Controls for the player.

2606-menumode.png

When I select a level from my GameMenu and open the level, I transition to MyGame mode and PlayerControls.

2607-gamemode.png

Hope this helps!

-W

2 Likes

Unfortunately, this is not what I meant. I am familiar with how to set the original game mode.

But my problem is transitioning from the main menu to the actual game [when the user selects new game]. This is how my blueprint is set up for my HUD, but while it does load the next level, it doesnt get rid of the main menu HUD/UI ro change to the free roam player controller.

1 Like

Try un-checking the Absolute Boolean on the Open Level Node, does this solve the issue?

What are your world settings in the level you are attempting to open? Also, do any of the Content Examples (more specifically Swing Ninja illustrate a way to handle transitioning from menu to game-play?)

-W

1 Like

Ignore me if I’m mistaken or stating the obvious, but typically in Unreal your main menu is just a result of loading a “menu” map which loads the menu HUD, PlayerController, GameMode etc to simulate a menu, right? Then when you hit “Start Game” you just load a real map whose default GameMode is set to an actual game instead of just a menu.

I guess what I’m asking is, what is the default GameMode for the Gion map you’re loading?

2 Likes

I’m not quite sure what is happening, but this is what I expected as well. When the new level is loaded, it loads the settings assigned by the GameMode which is assigned to that level (like in my previous comment).

Might be something else going on though.

1 Like

Did anyone ever actually answer this one? I know what the guy is saying (or appear to), what if you have a menu to host a game, and you have several gamemodes that you can use to play on a map… once the user selects which gamemode they want, how do you set it so it loads that game mode for the next level?

3 Likes

Figured this out:

How to change GameMode after player die in game

Tutorials are messy. They give a lot of bad information and as you start mixing them your projects also become messy as a result. SO! Just in case anyone comes across this looking for the same answer I was looking for. Which is “How to Hide HUD in main/start Menu” Check this out.

If you have your main menu setup as a level, and are using that level blueprint to load your menu BP/Widget. Make sure in the “World Settings” for the level/map the game mode is set to “none”. Then in “Project Settings” set the "Default Game Mode to “Game Mode” it is the default game mode that is in all projects.

I am leaving this here because the OP and I were asking the same question for slightly different reasons. But his post also made me realise my answer above.