The BeginPlay event in my main menu level blueprint just shows the main menu widget in the viewport. When Player1 clicks to host a game, the lobby widget is displayed. However, when Player2 clicks to join the game, the lobby widget is displayed quickly and then returns back to the main menu. The reason being is that when the Join Session blueprint node is called, it seems to be triggering the BeginPlay event on the level blueprint. Since I’m not changing levels, just displaying a lobby widget, the BeginPlay event is overriding the lobby widget and displaying the main menu widget again.
I could probably put some sort of check in the level blueprint to catch this. However, I want to know if this is expected behaviour? Should calling the Join Session blueprint node be triggering the BeginPlay of my level?
This shouldn’t happen, but it depends on your setup. Maybe share code so we can help you further
Here is the level blueprint for my main menu level. This BeginPlay obviously gets called by both the host and the client players when they start the game, which displays the main menu widget. From there they can navigate to the host menu or the server list menu respectively.
Once the host player has set up a game, they click on a button in the host menu, which calls this HostGame function in the game instance blueprint. I’m using the Advanced Sessions plugin, though I doubt that would have any affect right?
After the session has been created, the Lobby menu is displayed by calling the ShowLobbyMenu function in the game instance blueprint. (see previous images)
The client player then goes to the server list and clicks on the game to join.
From there, the JoinGame function is called in the game instance blueprint.
This is where the problem hits. When ShowLobbyMenu is called in JoinGame, the client player sees the lobby menu screen for about half a second before being returned back to the main menu. They are still in the session, they are just on the main menu instead of the lobby menu. This is happening because after they successfully join the session, BeginPlay is then being triggered on the level blueprint for no reason that I can see. This doesn’t happen to the host, only the client trying to join.
Anyone have any ideas? I’m stuck.