How to: create more than 1 room with same name
Options
is possible to: when user is creating a room, it's detect the RoomName after create, and if it exists in the lobby, don't create it ant return to room creator?
my script that creates room:
if(GUILayout.Button("Create Room"))
{
int myInt;
myInt = int.Parse(rPlayers);
if(myInt>16)myInt = 16;
PhotonNetwork.CreateRoom(rName, true, true, myInt);
joinedLobby=false;
}
my script that creates room:
if(GUILayout.Button("Create Room"))
{
int myInt;
myInt = int.Parse(rPlayers);
if(myInt>16)myInt = 16;
PhotonNetwork.CreateRoom(rName, true, true, myInt);
joinedLobby=false;
}
0
Comments
-
If you call CreateRoom with a roomname that's in use, it will fail on the server and you should get a fitting callback.
In the worker demo, you can attempt to create a named room in more than one client, if you want to check this out.
The name of a room is it's ID.0 -
Can you help me with this issue? i'm not sure how to do this, i'm newbie com PhotonNetwork right now
if you can make a example for me, or the script that i need '-'
thanks for the attention0 -
Your code is ok. The only missing piece is OnPhotonCreateRoomFailed handler.
Add method to the script controlling connection workflow:
void OnPhotonCreateRoomFailed(object[] codeAndMsg) // codeAndMsg[0] is int ErrorCode. codeAndMsg[1] is string debug msg.
{
// handle same name already in use error
}
PUN stays in lobby after creating room error. So you may try to join or create again.0