//public Image itemSprite; public ItemSlotBox(GameObject buttonPrefab, GameObject itemSlot, int index) { itemSlotBoxBeSet = false; itemSlotBox = Instantiate(buttonPrefab, itemSlot.gameObject.transform); itemSlotBox.name = index.ToString(); itemSlotButton = itemSlotBox.GetComponent <ItemButton>(); itemSlotButton.SetButtonNumber(index); //itemSprite = itemSlotBox.transform.GetChild(0).GetComponent<Image>(); }