Cannot switch game modes between levels

I have a whole level that is the main menu, and a special gamemode for that.

But once you start a new game and it loads the level, I have the “gamemode override” set to use a different gamemode. Except it continues to use the same menu gamemode.

I have the Project Settings ‘Default gamemode’ set to the menu one because it should always start using that game mode. But then it does not switch game modes whenever you change the level, WHYYYYYYY?

Update: I also noticed that if I open the in-game level > save > go back to main-menu level and play the game, it will work properly ONE time. And after that initial play, it will no longer change the game mode whenever it changes to the game level.

How are you changing game modes?

General method is to simply load level. The level settings define the game mode.

The first picture is inside the game instance, it basically is just the Open Level node.

The second picture is in the settings of the actual Level/Map. That is the only place I know of where you can change the GameMode with the exception of the global project settings.


Thoughts?

You need to define the game mode in the level settings for each level.

e.g.
Lvl-TDM, GM_TeamDeathmatch
Lvl-CTF, GM_CaptureFlag

When the level loads it reads the game mode from the settings and creates an instance of that mode.


Works correctly on my end.

image

image

image

image

In Lvl_CTF level blueprint I have the following:
image

In Lvl_TDM level blueprint I have the following:
image

In my character class, used for both levels, I have the following on Begin Play:
image

Tapping key 1 changes the map and the character prints the current game mode.


Optionally you can change the Game Mode for the given map with a parameter in the “Options”.

?game=/Game/Path-to-Gamemode/MyGameMode.MyGameMode_C

Downside is the new GM will use the previous GM’s character class and you will be forced to manually handle spawning.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.