What is the best way to join a room when player is already in a room?

Hi there! I'm working on moving our project from PUN to Fusion.

In PUN, we accomplish moving from one room to another with PhotonNetwork.LeaveRoom() and then with the callback OnLeftRoom(), trigger some "rejoin" logic that connects the player to the new room.

In Fusion, I don't see a Runner.LeaveRoom() function or anything similar.

I'm definitely open to accomplishing this feature in a way different from how we did it with PUN! What's the best way to do it?

Thank you so much for your time!

Best Answer

  • ramonmelo
    ramonmelo mod
    Answer ✓

    Hi @squirrel ,


    In Fusion, you always need to shut down the Runner in order to leave a Room and connect to a new one.

    So the steps would be just:

    1. Disconnect from the Cloud using runnerInstance.Shutdown();
    2. Run any disconnect logic in the OnShutdown() callback;
    3. Create a new instance of the NetworkRunner ;
    4. Start the simulation again using runnerInstance.StartGame(); as usual.


    --

    Ramon Melo

    Photon Fusion Team

Answers

  • ramonmelo
    ramonmelo mod
    Answer ✓

    Hi @squirrel ,


    In Fusion, you always need to shut down the Runner in order to leave a Room and connect to a new one.

    So the steps would be just:

    1. Disconnect from the Cloud using runnerInstance.Shutdown();
    2. Run any disconnect logic in the OnShutdown() callback;
    3. Create a new instance of the NetworkRunner ;
    4. Start the simulation again using runnerInstance.StartGame(); as usual.


    --

    Ramon Melo

    Photon Fusion Team