Hi,
I came across a bug that doesn't make items appear in the inventory when the player collects them.
I'm using a Horizontal Default Inventory.
Here is the specific list of in-game actions that reproduce the issue:
- add 3 items to the player's inventory
- delete the second item*
- make the player move to another scene
- add another item to the player inventory
What happens: the new item does not appear in the inventory.
*When I remove the second item, a hole remains in the inventory. Shouldn't the third item move to the second position?
Debugging the code, I noticed that itemList in RuntimeInventory#Add actually contains a null object in second position. Is it maybe not being removed correctly?
Thank you very much
Comments
Do you have Items can be re-ordered in Menu? checked in the Settings Manager. If that is enabled, then you will get holes in your inventory because the player can re-arrange items however they like.
Please post a screenshot of your Settings Manager, and I should have enough to attempt a recreation.
In RuntimeInventory.cs, there's a function named ReorderItems. Open it up and try replacing the code with the following:
private List<InvItem> ReorderItems (List<InvItem> invItems)
{
if (!KickStarter.settingsManager.canReorderItems)
{
for (int i=0; i<invItems.Count; i++)
{
if (invItems[i] == null)
{
invItems.RemoveAt (i);
i=0;
}
}
}
return invItems;
}