I am having the problem of my items not appearing in a single slot, it adds the item values together, but it fills the whole inventory with that item with the same item values, i have it down perfectly, i do not understand what is wrong, can someone please help me?
public void checkIfItemExist(int itemID, Item item)
{
for (int i = 0; i < Items.Count; i++)
{
Debug.Log(“Item With Same ID Has Been Found”);
if (Items*.itemID == itemID)*
{
Debug.Log(“An ItemStack Of " + item.itemName + " With The Value Of " + item.itemStack + " Has Been Added To A Stack With The Same ID”);
Items_.itemStack = Items*.itemStack + item.itemStack;
break;
}
else
{
addItemAtEmptySlot(item);
}
}
}
void addItem(int id, int stackSize)
{
Debug.Log(database.items.Count);
for (int i = 0; i < database.items.Count; i++)
{_
_if (database.items.itemID == id)
{_
_Debug.Log(database.items.itemName);_
_Item item = database.items;
item.itemStack = stackSize;_
_if (database.items.itemStackable)
{
checkIfItemExist(id, item);
break;
}
else if (i == Items.Count - 1)
{
addItemAtEmptySlot(item);
}
}
}
}
void addItem(int id)
{
Debug.Log(database.items.Count);
for (int i = 0; i < database.items.Count; i++)
{_
_if (database.items.itemID == id)
{_
_Debug.Log(database.items.itemName);_
_Item item = database.items;_
_if (database.items.itemStackable)
{
checkIfItemExist(id, item);
break;
}
else
{
addItemAtEmptySlot(item);
}
}
}
}*_