void Start() { gameObject.GetComponent <Button>().onClick.AddListener(() => { buttonclick(); }); init = GameObject.FindGameObjectWithTag("initializer").GetComponent <script_Initializer>(); buyb = GameObject.FindGameObjectWithTag("buybutton").GetComponent <buybutton>(); text_brand = transform.GetChild(0).GetComponent <Text>(); text_flavor = transform.GetChild(1).GetComponent <Text>(); text_qty = transform.GetChild(2).GetComponent <Text>(); text_price = transform.GetChild(3).GetComponent <Text>(); text_brand.text = brand; text_flavor.text = flavor; text_qty.text = qty.ToString(); text_price.text = "§" + price.ToString(); transform.SetParent(GameObject.FindGameObjectWithTag("buyparent").transform); transform.localScale = Vector3.one; if (index > 3 && itemamount > 4) { transform.localPosition = new Vector3(960 / (itemamount - 3) * (index - 3) - 480, -90, 0); } else if (index <= 3 && itemamount > 4) { transform.localPosition = new Vector3(960 / (4 + 1) * (index + 1) - 480, 20, 0); } else { transform.localPosition = new Vector3(960 / (itemamount + 1) * (index + 1) - 480, 0, 0); } buyb.index = -1; }