Question by
Dnielsen · May 03, 2021 at 10:22 PM ·
inventory system
Need help with my script (inventory) RPG
inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>();
for (int i = 0; i < inventory.slots.Length; i++)
{
if (inventory.isFull[i] == false)
{
inventory.isFull[i] = true;
Instantiate(itemButton, inventory.slots[i].transform, false);
break;
}
}
i am not sure if this is enought, for you to help.
here it search in all my slots to see if the slot is full or not. if it is empty, place the item.
what i need help for here, how do i merge items? something like this ?
if (inventory.isFull[i] == true) { look if the item I picked up, is the same in my inventory slot. destroy.gameobject. amount +=; break; }
Comment
Your answer

Follow this Question
Related Questions
Void being called 4 times, no apparent reason 1 Answer
2d mobile Multi Scene inventory 0 Answers
how I can save the data of a list of purchased items ? 2 Answers
Unity Inventory Database ID Error 1 Answer