Check If Room Exists
Options
When we creating a new Room using PhotonNetwork.CreateRoom and give It a name how to check If that Room name Exists or not ???
0
Comments
-
you can get list of room list available in lobby :
RoomInfo[] rooms= PhotonNetwork.GetRoomList ();0 -
for(int i = 0; i < rooms.Count; i++)
{
if(newRoomBeingCreated.Equals(rooms[i].name))
{
Match!
}
}
0 -
RoomInfo[] rooms = PhotonNetwork.GetRoomList();
for (int i = 0; i < rooms.Length; i++)
{
if (rooms[i].Name == "name")
{
Debug.Log("This room exists !");
break;
}
}0 -
RoomInfo[] rooms = PhotonNetwork.GetRoomList();
for (int i = 0; i < rooms.Length; i++)
{
if (rooms[i].Name == "name")
{
Debug.Log("This room exists !");
break;
}
}0 -
using System.Linq; List<RoomInfo> roomList = PhotonNetwork.GetRoomList().ToList(); RoomInfo room = roomList.FirstOrDefault(r => r.Name == roomName); bool exists = (room != null);
0