How to get a list of rooms available?

Options
Hello world! I'm having trouble understanding PUN's api. I've coded my own solution to getting a list of rooms in Unity OnGUI and joining said rooms by "scrolling" (iterating) through a generic list where I store the names of the rooms. I can then join the room by scrolling through the generic list and pulling the string (name of the room) and adding it to the end of PhotonNetwork.JoinRoom(IN HERE); so my code is PhotonNetwork.JoinRoom(rooms[index]);

However, I did notice the whole photonNetwork.GetRoomList thing and all sorts of other helpful functions in the PUN API. The problem is I don't understand how to use them. It seems to me like all the tools are there to make things like displaying a list of available rooms and joining these rooms faster and easier, but if you don't know how to use a tool then it's useless to you. Since I didn't know how to turn on the chainsaw I went and got my trusty handsaw, so to speak. My concern is that eventually (like when implementing chat) I will hit a roadblock. Obviously I'm not asking you to teach me how to read the API, all I want is for someone to tell me how the hell to use:

Debug.Log(PhotonNetwork.GetRoomList());

console displays : RoomInfo[]
UnityEngine.Debug:Log(Object)

Just a little help will help me "feel" my way through the API and learn it, that's how I learned Unity's API. Also, my understanding is that GetRoomList returns an array. Can I then do something like GetRoomList[23] to pull the 24th room in the lobby?

Comments