public void SetButtons(ItemBag itemBag, CanvasController canvas) { for (int i = 0; i < slots.Length; i++) { if (i >= itemBag.GetBag().Count) { slots[i].DisableSlot(); } else { Item item = itemBag.GetBag()[i]; slots[i].EnableSlot(item, itemBag.GetStackNo(item), canvas); } } canvas.eventsystem.SetSelectedGameObject(slots[0].GetComponentInChildren <Button>().gameObject); }