private void SelectSlot(int slot) { DeselectObject(); // Set slot to 0 if negative if (slot < 0) { slot = 0; } // Set slot to max if greater than max if (slot > inventory.GetItemList().Count - 1) { slot = inventory.GetItemList().Count - 1; } // Select slot and get item selectedSlot = slot; selectedItem = inventory.GetItem(selectedSlot); // Display name and type of selected pet selectedObjectDisplay.text = selectedItem.type; selectedNameDisplay.text = selectedItem.name; // Move selected UI outline selectedSlotDisplay.transform.position = inventoryUI.GetUIItemList()[selectedSlot].gameObject.transform.position; }