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:
- 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
- If I use a Default Pawn instead of the player character, it spawns the DefaultPawn at 0,0,0
- 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
- 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.