void InitInventoryList() { for (int i = 0; i < Inventory.Instance.InventorySize; i++) { GameObject go = GameObject.Instantiate(itemSlot) as GameObject; if (go != null) { go.transform.SetParent(gameObject.transform); go.transform.localScale = Vector3.one; InventorySlotUI slot = go.GetComponent <InventorySlotUI>(); if (slot != null) { slot.InitSlot(i); } } } }