Create GameState when loading level

It’s possible, think about how in a typical multiplayer FPS (which the design of the Unreal engine is rooted in), you can have multiple maps (levels) and multiple modes (deathmatch, team deathmatch). You can play a single map with different game modes.

So when loading the level you need to be able to specify the game mode to use. The game mode will in turn indicate what game state to use.

Check out the answers in this post by Nostrildumbass. Looks like you need to pass a query string to the level to determine which game mode to use:

I’ll just quote it here in case that link dies:

I know this is super old, but I wanted to comment with what worked for me.

In my HUD widget (I was working on a simple main menu that lets me choose game modes), I used Open Level to load the level and added this as a parameter in the options input:

?Game=/Game/Player/Blueprints/ThirdPersonGameMode.ThirdPersonGameMode_C

Don’t be fooled, the _C at the end will not be in the name of your game mode. If it is, you might need another _C at the end. This is awful design in my opinion, as nothing anywhere in my gamemode/files had an _C at the end.

Hope that helps :grinning: