How to detect disconnect to Master server

Options
In my project, I have registered callback in OnFailedToConnectToPhoton , OnDisconnectedFromPhoton and OnConnectionFail so that it can detect user disconnect network or Photon server.

However sometimes player encounter ( or manually occur by connect to NameServer)
JoinRandomRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster
without above disconnection callback triggered.

How can I get the callback of disconnect to master server?

Comments

  • forgemaster
    Options
    The callback to detect on discconect from master server is
    public override void OnDisconnected(DisconnectCause cause) {}
    
    After you disconnect you must reconnect back to the Photon servers using..
    PotonNetwork.ConnectUsingSettings();
    
    ..in order to invoke
    PhotonNetwork.JoinRandomRoom();
    
  • DarrenL
    DarrenL
    edited March 2020
    Options
    I cannot find OnDisconnected(DisconnectCause cause) in my PunBehaviour class.
    I am using PUN classic