private void RealmInventoryRowEmptied(int rowNumber) { if (rowNumber > 3 && rowNumber == InventoryRows.Count) { for (int i = rowNumber; i > 3; i--) { if (InventoryRows[i - 1].HasItems) { break; } InventorySlots.RemoveAll(slot => InventoryRows[i - 1].InventorySlots.Contains(slot)); Destroy(InventoryRows[i - 1].gameObject); MaxCapacity -= InventoryRows[i - 1].SlotCount; InventoryRows.RemoveAt(i - 1); } } }