PhotonNetwork.Disconnect()

Options
Hello Everyone! I am newbie in learning photon . I reached on learning PUN Basics Tutorials in 4th topic
(4 - Game Manager & Levels).
There at last portion a boolean is used "isConnecting" for stopping re-enter in the same scene.
I have one question cant we use PhotonNetwork.Disconnect() in LeaveRoom() function
instead of using isConnecting boolean variable.

if (isConnecting)
{
PhotonNetwork.JoinRandomRoom();
isConnecting = false;
}
instead of this what if I use

public void LeaveRoom()
{
PhotonNetwork.LeaveRoom();
PhotonNetwork.Disconnect();
}

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Rambo,

    Thank you for choosing Photon!

    "isConnecting" naming is maybe a bit misleading and we may even clean it up or get rid of it.

    It does not make sense to call LeaveRoom and Disconnect directly sequentially one after the other since you would want to wait for the player to finish leaving first then disconnect, or disconnect directly without calling LeaveRoom or in case you use both, then the disconnection will most likely happen before leaveRoom finishes.
  • Rambo
    Options
    Sorry for late reply
    Thank you so much for your help
    yes, I make sense now