Is this the proper way to instantiate button prefabs as a child of an object in uGUI? I’m not getting any sort of instantiation, so I’m wondering if this is the proper way to go about it:
for (int i = 0; i < hostData.Length; i++) {
Transform serverPrefabButton = Instantiate (serverPrefab, new Vector3 (0, 0, 0), Quaternion.identity) as Transform;
serverPrefabButton.parent = window.FindChild ("ServerList");
serverPrefabButton.GetComponent<NetworkID> ().networkID = i;
serverPrefabButton.GetChild (0).GetComponent<Text> ().text = hostData *.gameName;*
serverPrefabButton.GetChild (1).GetComponent ().text = (hostData .connectedPlayers - 1).ToString () + “/” + (hostData .playerLimit - 1).ToString ();
* //Each of the available public servers are listed as buttons and the player*
* //clicks on the relevant button to connect to a public server.*