What happens to the Game Mode when a new level is opened?

I’m trying to build a UI where the game starts with character selection and then moves forward to the level.

I’m doing the UI building through the game mode.

Except when I open the new level, the game mode is respawed and basically I end up with the UI being respawed too.

Is there a blueprint that isn’t respawned with the level? Game State? Game Instance?

Game Instance is not reset. But it doesn’t have a BeginPlay function, so you’ll have to call your custom functions from elsewhere.

1 Like

What i did with character selection in my game is that i have two separate Game Modes and maps.

One that i called GM_lobby have the character selection. The other GM_play does not.

Once the character is selected on GM_lobby i save it to a variable in the Game Instance, and on GM_play beginPlay event i retrieve it from the Game Instance.

2 Likes

Game mode is defined in the “Levels Settings”, thus when the level loads it loads the defined game mode.

2 Likes

Thanks! This worked well for me.

Thank you everyone for your help!
And especially @Rev0verDrive for the link to the game flow diagram! That helped understand the flow hierarchy too!

By the way I made a new Game State blueprint and assigning it in the Game Mode makes BeginPlay events stop firing??

Does anybody know how to fix it?

This doesn’t work anymore for me. I create three BPs (BP_GameInstance, GM_MainMenu, GM_Gameplay). I added an integer variable on the instance for testing. On the main menu I add 1 to the variable. Then I Open Level that has the GM_Gameplay on it and print the variable from the game instance and it is the default value. I have left everything else the default values and this is a brand new project:

Game Instance: BP_GameInstance
Main Menu: MainMenuMap with a GM_MainMenu
Game World: GameplayMap with a GM_Gameplay
Everything else is default Third Person Template.

Has this behavior changed since you implemented?