Leave & Quit from a Game Session to a Lobby

Options

Hi,

I wanted to implement a feature where players can leave the game session (after Runner.StartGame(...)) and return back to the Shared Lobby. This assumes they joined the lobby initially before calling Runner.StartGame(...).

Do I have to shutdown the runner, start the runner and rejoin the lobby manually? From the Application Loop and Karts sample, both disconnect from the game entirely upon leaving the session.

Answers

  • Hunel
    Options

    I am also looking for the answer to this question.

    I searched but couldn't find it.

  • Yepnoob
    Options
    1. void Update()
    2. {
    3.    if (Input.GetKeyDown(KeyCode.Escape))
    4.    {
    5.       PhotonNetwork.DestroyPlayerObjects(PhotonNetwork.player);
    6.       PhotonNetwork.LeaveRoom();
    7.       PhotonNetwork.LoadLevel(0);
    8.    }
    9. }


  • Flaemnova
    Options

    @Hunel

    For now I've just

    1) shutdown networkRunner

    2) create new networkRunner

    3) re-enter lobby with new networkRunner

  • MHG_Developer
    edited February 2023
    Options

    @Flaemnova Had same question. I find the examples a bit confusing as they all seem to be switching scenes constantly when connecting to parts of Fusion: lobby, staging, gameover, etc. I gather this is just showing off how Fusion is scene agnostic? And doesn't loose the session in between loads? I don't know, but it's not how I am used to working the problem in Unity.

    The Fusion Application Loop example in the Technical Examples is the one I found that simply shows the whole game loop from connect to disconnect.

    Fusion Application Loop | Photon Engine