JoinRandomRoom fails but OnPhotonRandomJoinFailed will not be called back!!!
Options
I use JoinRandomRoom and when OnPhotonRandomJoinFailed is called back, i know any room not exists then i use CreateRoom. because PUN has not any api like JoinRandomRoomOrCreate().
My problem is that in rarely times, JoinRandomRoom throws error GameDoesNotExist and OnPhotonRandomJoinFailed will not be called back.
My problem is that in rarely times, JoinRandomRoom throws error GameDoesNotExist and OnPhotonRandomJoinFailed will not be called back.
0
Best Answer
-
You should be able to do by implementing PUN callback:
bool randomJoin; void OnPhotonJoinRoomFailed(object[] codeAndError){ int error = (int)codeAndError[0]; string msg = codeAndError[1] as string; if (error == ErrorCodes.GameDoesNotExist) { if (randomJoin) { // retry join random room } } }
5
Answers
-
Hi @ahoogol,
GameDoesNotExist is an error for JoinRoom operation and not for JoinRandomRoom. It happens on GameServer.
It happens when the MasterServer returns a GameID and GameServer IP address to the client for a matched room as a response to JoinRandomRoom operation. But meanwhile when the client disconnects from MasterServer and then connects to GameServer and tries to enter the room using JoinRoom operation the room does not exist anymore as it was disposed by the server.
What you can do:
1. You can try to increase the EmptyRoomTTL, max value for cloud is 300000 milliseconds (5 minutes) to avoid this case.
2. Use AsyncRandomLobby type. Rooms stay listed inside this lobby for 1 hour after they are disposed. I need to check if you need some webhooks config for this as well.
3. When you catch this error, repeat JoinRandomRoom logic.0 -
-
You should be able to do by implementing PUN callback:
bool randomJoin; void OnPhotonJoinRoomFailed(object[] codeAndError){ int error = (int)codeAndError[0]; string msg = codeAndError[1] as string; if (error == ErrorCodes.GameDoesNotExist) { if (randomJoin) { // retry join random room } } }
5