- Home /
[PUN] Server List GUI Help
Hi
I need to have a server list for my game but I do not know how to make one. I want to have the server list using the "GUI.___" something instead of GUILayout. But the current code that can be found in the demo files are in GUILayout so I have no idea how I can make one. If you know how I can make a server list, please tell me!
Here is the code that I am currently using as a placeholder if it helps.
foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList())
{
GUILayout.Label(roomInfo.name + " " + roomInfo.playerCount + "/" + roomInfo.maxPlayers);
if (GUILayout.Button("Join Server"))
{
PhotonNetwork.JoinRoom(roomInfo.name);
}
}
Thanks
Answer by AlucardJay · May 18, 2014 at 12:36 PM
Really, you ned to think about the process to get the desired result. What do you have, and what do you want?
A list of rooms that are iterated through with a foreach loop.
For every room, display the name, player count, then a button to join, all in a single row.
untested pseudocode to demonstrate the process
int i = 0;
foreach ( RoomInfo roomInfo in PhotonNetwork.GetRoomList() )
{
GUI.Box( new Rect( 20, 20 + (i * 30), 300, 25 ), roomInfo.name + " " + roomInfo.playerCount + "/" + roomInfo.maxPlayers );
if ( GUI.Button( new Rect( 320, 20 + (i * 30), 100, 25 ), "Join Server") )
{
PhotonNetwork.JoinRoom(roomInfo.name);
}
i ++;
}
Thank you. How to do it with new UI? How to get room list with new UI and connect to one of them? Thanks again.
Your answer
Follow this Question
Related Questions
how to host unity multiplayer game in my vps? 0 Answers
Enable logging in custom script (Photon Server) 2 Answers
Tutorial for photon server who host the map? 0 Answers
Client-Server implementation suggestions for asynchronous multiplayer mobile game? 1 Answer
Can I create one server using Photon? 0 Answers