Check If Room Exists
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Check If Room Exists
Imperial
2016-05-30 11:36:37
When we creating a new Room using PhotonNetwork.CreateRoom and give It a name how to check If that Room name Exists or not ???
Comments
JANESTHEKING
2016-05-30 11:41:50
you can get list of room list available in lobby :
RoomInfo[] rooms= PhotonNetwork.GetRoomList ();
for(int i = 0; i < rooms.Count; i++)
{
if(newRoomBeingCreated.Equals(rooms[i].name))
{
Match!
}
}
RoomInfo[] rooms = PhotonNetwork.GetRoomList();
for (int i = 0; i < rooms.Length; i++)
{
if (rooms[i].Name == "name")
{
Debug.Log("This room exists !");
break;
}
}
RoomInfo[] rooms = PhotonNetwork.GetRoomList();
for (int i = 0; i < rooms.Length; i++)
{
if (rooms[i].Name == "name")
{
Debug.Log("This room exists !");
break;
}
}
using System.Linq;
List roomList = PhotonNetwork.GetRoomList().ToList();
RoomInfo room = roomList.FirstOrDefault(r => r.Name == roomName);
bool exists = (room != null);
:)
Back to top