Download

Does Join Session cause the level blueprint to fire BeginPlay?

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 :slight_smile:

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.

8fcb273f5aee4af46bde30f2724bca7638e40bf0.png

9b6cd5c6bfa8dbc0231020b4a69b28232a03fb47.png

5ce20c7cc6f204932f9e5a0c63c2fbf16355aebc.png

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?

4a23cc6a8c071e979e59f69c75fd1063a426e3ad.png

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.

45f7550d5291cf3bb482f693e7251e0ca3097380.png

From there, the JoinGame function is called in the game instance blueprint.

e29141f257901df1cf4679f5cf7c236dd250b98f.png

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.