What is the correct setup for menu's and levels??

Hey all.

I’m trying to do a quick tutorial for my students and I’m having some issues with my understanding of the Unreal Engine way of doing things.

So I’ve got this current setup:

I have a gameinstance blueprint which has the “game state” in it. Other blueprints can bind to be notified of state changes.

I have a persistant main menu level which in its level blueprint binds to the gameinstance game state updates, creates a UI view per state and then calls SetState(MainMenu) to start the main menu displaying.

In the main menu, I have a button “play game” which then calls an event on the gameinstance which tells it to stream a level and then calls SetState(InGame) once the level is loaded

Inside the streamed level, I have a trigger, which triggers a win condition, which then calls SetState(Win) on the gameinstance, which then causes the win screen to be displayed via the MainMenu level blueprint.

Now my problems are:

  1. When I stream the level, it loads ok, but for some reason the player character I spawn in control of doesn’t spawn at the player start that is in the level
  2. If I use a Default Pawn instead of the player character, it spawns the DefaultPawn at 0,0,0
  3. If I then use the DefaultPawn to enter the win trigger, go back through the menu and load the level again, the default pawn is still around and doesn’t have its location reset
  4. If I replace the stream level with an open level call, I get a crash

So my question is… for the default setup of a games main flow, what kind of setup do you guys use? I’m thinking like a game where it has multiple levels, main menu, perhaps a level select etc.

Why would the use of a streamed level not use the player start? Where as loading the exact same level in the PIE works fine?
Would it be better to shove all of the menu state and widgets into the gameinstance? That way no level loading will affect the UI. I suspect I get the crashes on openlevel because the UI is being nuked by the loading mechanism trashing the persistant menu level which currently holds my UI widgets etc.

Is there a simple example using blueprints of a simple game setup with menu->game->menu flow? I know the top down example could do it for the C++ guys, but I’m wondering about a blueprint example.

Sorry for all the questions. Just need to get a better picture so I can be clear about it to my students.

My approach is actually to have as few persistent variables as possible. Streaming levels is fancy, but unless you need that I find it better to completely unload the current level and load the next one. In blueprint that is done using the OpenLevel node.

The advantage to this is that each map can have its own game mode. Then, you make a map for your main menu that has a dummy game mode and UMG menus or whatever you want to use for the menu contents. Gameplay levels are different maps with a game mode that features gameplay. You can set a game mode per map via the world settings which override the project settings. Unloading and loading also ensures that there are no remnants of previous levels that can lead to unexpected results, for example when streaming levels I think the PlayerStarts from a previously loaded map are still present. That can cause the issues you’ve described.

I like to see it this way: map + game mode make the overall ‘game state’.