public bool Add(Item item) { /* * Add a single item in the inventory (ex: if you loot a single sword) */ if (!item.isDefaultItem) { ItemStack itemStack = itemsStack.Find(x => x.item == item); if (itemStack != null) { itemStack.AddStack(); } else { if (itemsStack.Count >= space) { Debug.Log("Not enough space in inventory"); return(false); } itemsStack.Add(new ItemStack(item)); } onItemChangedCallback?.Invoke(); return(true); } return(false); }