Getting server browser with photon ?
I want to put a server browser so the players can see the servers and join it, does any one know how to do it?
Answer by beyluta · Mar 15, 2016 at 09:40 PM
Make sure the autoJoinLobby is checked in the PhotonServerSettings. It always comes disabled!
public bool IsConnected;
public string roomName;
IsConnected = false;
roomName = "room01";
void OnGUI() {
if (IsConnected) {
GUILayout.BeginArea (new Rect (Screen.width / 2 - 250, Screen.height / 2 - 250, 500, 500));
roomName = GUILayout.TextField (roomName);
if (GUILayout.Button ("Create")) {
PhotonNetwork.JoinOrCreateRoom (roomName, null, null);
}
foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
if (GUILayout.Button (game.name + " " + game.playerCount + "/" + game.maxPlayers)) {
PhotonNetwork.JoinOrCreateRoom (game.name, null, null);
}
}
GUILayout.EndArea ();
}
Answer by tobiass · Sep 08, 2015 at 09:37 AM
There is no server browser in the traditional way for Photon. The host is always Photon or one machine in the Photon Cloud. What you list are rooms where players actually play. If you want that, have a look at the "Worker Demo" in the PUN package. Start multiple clients and make sure some of them create rooms (otherwise the list will be empty, of course). And: In PUN v1.60, make sure to check "Auto Join Lobby" in the PhotonServerSettings as described here.
Your answer
Follow this Question
Related Questions
Photon camera problum 0 Answers
Help With Network Animations 0 Answers
Need help understanding why controller isn't spawning with head over network 0 Answers