private PlayerControllerData MakeButton(int id, int layout, int pid) { //pcd.button = (Transform) Instantiate(playerButtonPrefab, new Vector3( -18f + ((pcd.playerId-1)%4)* 12f, 12.8f - ((pcd.playerId-1) / 4) * 3f, 0), Quaternion.identity); Transform button = (Transform)Instantiate(playerButtonPrefab, new Vector3(((pid - 1) % 8) * 0.13f + 0.07f, 0.94f - ((pid - 1) / 8) * 0.1f, 0), Quaternion.identity); PlayerControllerData pcd = button.GetComponent <PlayerControllerData>(); pcd.Init(id, layout, pid); button.Find("Texts").Find("PlayerText").GetComponent <GUIText>().text = "Player " + pcd.playerId; pcd.infoText = button.Find("Texts").Find("InfoText").GetComponent <GUIText>(); pcd.SetButtonText("Waiting!"); pcd.SetButtonColor(); //pcd.GetComponent<AudioSource>().pitch = 1f + pcd.playerId / 10f; return(pcd); }