::Glad you fix it Jaylen. Just to provide context for anyone else reading this, ArgumentOutOfRangeExceptions occur when you try to access arrays or list items with indexes beyond the length of the array. For example:
int[] nums = new int[4];
// This will cause an ArgumentOutOfRangeException because the array only has 4 items.
nums[6] = 10;
In Jaylen’s case, it’s probably caused by this chunk of code in InventoryManager (judging from his screenshot):
public void AddWeapon(int slotIndex, WeaponController weapon) //Add a weapon to a specific slot
{
weaponSlots[slotIndex] = weapon;
weaponLevels[slotIndex] = weapon.weaponData.Level;
weaponUISlots[slotIndex].enabled = true; //Enable the image component
weaponUISlots[slotIndex].sprite = weapon.weaponData.Icon;
}
Specifically, if you try to call AddWeapon()
and pass a slotIndex
of more than 5, it will cause the error.