it seems the “item” in line 68 does not exist, but line 56 would have stopped this? and the debugs show the item does exist?
public void ConfirmTransaction()
{
Inventory shopperInventory = currentShopper.GetComponent<Inventory>();
if(shopperInventory = null) return;
// Transfer to or from the inventory
var transactionSnapshot = new Dictionary<InventoryItem, int>(transaction);
foreach (InventoryItem item in transactionSnapshot.Keys)
{
Debug.Log(item.name);
int quantity = transactionSnapshot[item];
Debug.Log(" qty = " + quantity);
for (int i = 0; i < quantity; i++)
{
bool success = shopperInventory.AddToFirstEmptySlot(item, 1);
Debug.Log(" found slot = " + success);
if (success)
{
AddToTransaction(item, -1);
}
}
}
// Removal from transaction
// Debting or Crediting of funds
}