The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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 ();

Dev
2016-05-30 13:05:41

for(int i = 0; i < rooms.Count; i++)
{
if(newRoomBeingCreated.Equals(rooms[i].name))
{
Match!
}
}

CapPotato
2017-04-28 21:30:53

RoomInfo[] rooms = PhotonNetwork.GetRoomList();

for (int i = 0; i < rooms.Length; i++)
{
if (rooms[i].Name == "name")
{
Debug.Log("This room exists !");
break;
}
}

CapPotato
2017-05-02 10:39:55

RoomInfo[] rooms = PhotonNetwork.GetRoomList();

xblade724
2017-07-27 11:24:43

using System.Linq;

List roomList = PhotonNetwork.GetRoomList().ToList();  
RoomInfo room  = roomList.FirstOrDefault(r => r.Name == roomName);  
bool exists = (room != null);  

:)

Back to top