private GameObject InstantiateField(string name) { GameObject go = UnityEngine.Object.Instantiate(fieldPrefab, fieldParent.position, Quaternion.identity) as GameObject; go.transform.SetParent(fieldParent, false); go.transform.position = Vector3.zero; go.GetComponentInChildren <Text>().text = name; //Debug.Log("created a field for: " + name); //add the functionality to tell the overview the quizName Button button = go.GetComponent <Button>(); button.onClick.AddListener(delegate { overview.SetQuizName(name); }); //add functionality to enlarge the overview window, update it and open it button.onClick.AddListener(delegate { overviewResizer.SetLarger(); }); button.onClick.AddListener(delegate { overview.UpdateOverview(); }); button.onClick.AddListener(delegate { windowManager.OpenWindow(overviewWindow); }); return(go); }