Question by
jtojung · Sep 01, 2019 at 03:12 AM ·
inventory systemitemitem pickup
the unable stack item(equip) change to stack item(consume) and amount increase.
In my inventory, there are stackable and unable-stack items. When I pick unable stack item first and then stackable item, first one change to stackable item and amount increase,I have stackable item and unable stack item. when I pick up disable stack one first and then pick stackable item, the first item change to stack item and amount increase. I am not sure what is wrong?
private void Update()
{
if (isInRange && !isEmpty)
{
if(item.ID == item.ID)
{
Item itemCopy = item.GetCopy();
if (inventory.AddItem(itemCopy))
{
amount--;
if (amount == 0)
{
isEmpty = true;
}
}
else
{
itemCopy.Destroy();
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Item is missing in inventory slot after i pick up and delete the item. C# 0 Answers
Adding a prefab to the Item class instance 0 Answers
inventory and item system where every item need its own use function 0 Answers
Items not adding correct values to inventory when multiple colliders hit at once. (2D Game) 0 Answers