void Start() { int Slotamount = 0; Gameitem = Gameitem.gameObject.GetComponent <CharactorController>(); database = GameObject.FindGameObjectWithTag("ItemDataBase").GetComponent <ItemDataBase>(); for (int i = 1; i < 6; i++) { for (int k = 1; k < 5; k++) { GameObject slot = (GameObject)Instantiate(slots); slot.GetComponent <SlotScript>().slotNumber = Slotamount; Slots.Add(slot); Items.Add(new Item()); slot.transform.SetParent(this.gameObject.transform); slot.name = "Slot" + i + "." + k; slot.GetComponent <RectTransform>().localPosition = new Vector3(x, y, 0); x = x + 50; if (k == 4) { x = -77; y = y - 40; } Slotamount++; } } }
// Use this for initialization void Start() { PlayerObject = GameObject.FindGameObjectWithTag("Player"); EventFlow = GameObject.FindGameObjectWithTag("Player").GetComponent <CharactorController>(); }