Reconnect to a random room

Hi,

I am using JoinRandomRoom to establish a connection between players. However, I found that if someone disconnect, it is hard to make sure that it can join back to such room after he/she reconnect in a second.

I think a way to assign a room name after connect to Random Room but don't know how. Can anyone give me some advices?

Thanks.

Comments

  • Hi,

    Joined room already has name (assigned automatically or explicitly in CreateRoom call).
    Use PhotonNetwork.room.name to get the name.
  • Thanks. Can I set a threshold/timeout for disconnect? In Photon, any "OnDisconnect" function will be triggered once disconnection detected?
  • Probably you asking for PhotonNetwork.networkingPeer.DisconnectTimeout.

    PUN does not have OnDisconnect function. It has OnPhotonPlayerDisconnected called when remote player disconnected and OnDisconnectedFromPhoton called when client itself disconnected.