Create Room/Join Room Issue

Hi,

When using PhotonNetwork.CreateRoom, if the room exists a debug message is fired.
"createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {}."

Is it possible to get the client to connect to the room automatically if the room already exists? As I am trying to connect two players to a 1v1 room.

I would imagine that there would be a method called something like "PhotonNetwork.DoesRoomExist()" but I cant find anything that does this.

I tried rolling my own, but I think that the room list is not getting updated fast enough and then both clients try and create a room. Which then causes one of them not to connect as the room now exists.

[code2=csharp]bool found = false;
foreach(RoomInfo room in PhotonNetwork.GetRoomList()){
if(room.name == roomName){
found = true;
PhotonNetwork.JoinRoom(room);
break;
}
}
if(!found)
PhotonNetwork.CreateRoom(roomName,true,true,2);[/code2]

What is the correct way to handle this problem?

Thanks,
David

Comments