PhotonNetwork.GetRoomList() not listing rooms.
Options
Hey, I've been messing around in Photon and right now I am in the process of trying to make Lobby page. I need to retrieve the lobbied (of course) but PhotonNetwork.GetRoomList() isn't returning any rooms. Here the code.
Heres the code:
public void listRooms(){
Debug.Log(PhotonNetwork.GetRoomList().Length);
foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
...UI portion here...
}
}
Heres how I create the server:
public static void CreateRoom(string name, byte maxPlayers){
RoomOptions roomOptions = new RoomOptions ();
roomOptions.maxPlayers = maxPlayers;
roomOptions.isOpen = true;
roomOptions.isVisible = true;
PhotonNetwork.JoinOrCreateRoom (name, roomOptions, TypedLobby.Default);
}
What happens is that the where it says
Debug.Log(PhotonNetwork.GetRoomList().Length);
it returns as a 0 always. I've tested it in every scenario but it will just not work,. Any help would be great!
Heres the code:
public void listRooms(){
Debug.Log(PhotonNetwork.GetRoomList().Length);
foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
...UI portion here...
}
}
Heres how I create the server:
public static void CreateRoom(string name, byte maxPlayers){
RoomOptions roomOptions = new RoomOptions ();
roomOptions.maxPlayers = maxPlayers;
roomOptions.isOpen = true;
roomOptions.isVisible = true;
PhotonNetwork.JoinOrCreateRoom (name, roomOptions, TypedLobby.Default);
}
What happens is that the where it says
Debug.Log(PhotonNetwork.GetRoomList().Length);
it returns as a 0 always. I've tested it in every scenario but it will just not work,. Any help would be great!
0
Comments
-
You need to turn it on in the pun assets folder. I believe it's in the settings one, just check the box(es). I had the same problem. If you would have searched, you would have seen a previous question.
Take care0 -
Hi,
PhotonNetwork.GetRoomList() works only while client is in the lobby. So you need at least 2 clients. One in the room (probably one which created it) and one in the lobby checking the list.0