PUN2 - PhotonNetwork.JoinRandomRoom Timeout
Options
Hi,
Is there any timeout for PhotonNetwork.JoinRandomRoom in the callbacks for PUN2? I am just checking before I implement my own. It seems that there is none (after several tests). Otherwise, that might be a good addition to the codebase in a future update.
Thank you.
Is there any timeout for PhotonNetwork.JoinRandomRoom in the callbacks for PUN2? I am just checking before I implement my own. It seems that there is none (after several tests). Otherwise, that might be a good addition to the codebase in a future update.
Thank you.
0
Comments
-
Sometimes this will just hang and never return any callback. I am thinking I better add a coroutine to eventually fail and instead create a new room.
var tryingToJoinRandomRoom = PhotonNetwork.JoinRandomRoom(); Debug.Log("Trying to join random room is : " + tryingToJoinRandomRoom);
0 -
Hi @tcmeric,
There is no timeout.
But if the server does not find a match it will return an error response.
Usually, in the error response callback, you create a new room.
ImplementIMatchmakingCallbacks.OnJoinRandomFailed(short returnCode, string message)
(if you do, do not forget to register and deregister class) or extendMonoBehaviourPunCallbacks
and overrideOnJoinRandomFailed
.
Read more about callbacks.1 -
Hi, thanks John. Thank you for posting. I figured out the issue. I had a called back method implemented for
public override void OnJoinRoomFailed(short returnCode, string message)
In offline mode, a room can be successfully joined, called "Offline Room". So I didnt figure out I was using the incorrect callback. When online, no room is automatically created.
Interesting that offline mode automatically has a room created, but that for online mode this is different. A little quirk
I have now used the correct call back method.0