/*take height of screen * divide by number of parts * set button height to that division * move down by height */ //creates the list of objects based off prefabs in list void GenerateList(string search) { ClearButtons(); posY = location.transform.position.y; foreach (GameObject i in parts) { if (search == "" || i.name.Contains(search)) { tmp = Instantiate(button, location.transform, false); tmp.SetActive(true); tmp.transform.SetParent(location.transform); tmp.transform.position = new Vector3(location.transform.position.x, posY, 0); tmp.GetComponent <Button>().onClick.AddListener(delegate { cont.SpawnObject(i); }); tmp.transform.GetChild(0).GetComponent <Text>().text = i.name; tmp.GetComponent <Button_Controls>().ol = this; posY -= tmp.GetComponent <RectTransform>().sizeDelta.y *canvas.GetComponent <Canvas>().scaleFactor; buttons.Add(tmp); } } tmp = null; }