public void RemoveItem(ItemData item) { Item itemToRemove = item.item; Dictionary <Item, int> inventory = inventoryModel.inventory; if (inventory.ContainsKey(itemToRemove)) { // if the item is in the list if (item.currentSlot.Amount < inventory[itemToRemove]) { // if the amount to remove is lower than the amount in the inventory inventory[itemToRemove] -= item.currentSlot.Amount; // updates the amount of the model } else { // remove the item completely if (item.currentSlot.Amount > inventory[itemToRemove]) { Debug.Log("Possible bug, on a essayer d'enlever des items en rab"); } inventory.Remove(itemToRemove); // remove the item } } inventoryView.ClearSlot(item.currentSlot); }