Leave & Quit from a Game Session to a Lobby

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Leave & Quit from a Game Session to a Lobby

Flaemnova
2022-07-07 04:38:00

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.

Comments

Hunel
2022-07-11 13:15:39

I am also looking for the answer to this question.

I searched but couldn't find it.

Yepnoob
2022-07-11 15:17:01

void

  • Update()

  • {

if

  • (Input.GetKeyDown(KeyCode.Escape))

  • {

  • PhotonNetwork.DestroyPlayerObjects(PhotonNetwork.player);

  • PhotonNetwork.LeaveRoom();

  • PhotonNetwork.LoadLevel(0);

  • }

  • }

Flaemnova
2022-07-18 03:17:58

@Hunel

For now I've just

  1. shutdown networkRunner

  2. create new networkRunner

  3. re-enter lobby with new networkRunner

MHG_Developer
2023-02-16 18:35:27

@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

Back to top