- Home /
Question by
cirex02727 · Sep 27, 2018 at 04:46 PM ·
listphotonpunroom
PhotonNetwork.GetRoomList() output = 0
i have make a simple main menu with a input field and a button:
public InputField NameField;
bool Pressed = true;
public void OnClick_ConfirmB()
{
if(NameField.text != "" && Pressed == false)
{
Pressed = true;
PhotonNetwork.playerName = NameField.text;
//SceneManager.LoadScene(1);
JoinLobby();
}
}
void OnConnectedToMaster()
{
Pressed = false;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
OnJoinedRoom();
}
}
void Awake()
{
PhotonNetwork.ConnectUsingSettings("Version 0.1");
}
void OnGUI()
{
GUI.Label(new Rect(10, 10, 100, 100), PhotonNetwork.connectionStateDetailed.ToString());
}
void JoinLobby()
{
PhotonNetwork.JoinLobby();
}
void OnJoinedLobby()
{
RoomOptions Options = new RoomOptions() { IsVisible = true, IsOpen = true};
PhotonNetwork.CreateRoom("GG", Options, TypedLobby.Default);
}
void OnJoinedRoom()
{
Debug.Log("room length : " + PhotonNetwork.GetRoomList().Length);
}
OnClick_ConfirmB() is connected to a button... the roomlist debug output is 0; i do not understand, plz help mi
Comment
For everybody who is interested, we have the same discussion here.
Answer by storybelldev · Oct 02, 2018 at 01:27 PM
PhotonNetwork.GetRoomList() only works in the lobby.