Forum rules - please read before posting.

[Bug] Inventory items not being added/removed properly

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

  • Thanks for the report.  By delete, you mean remove in-game, not delete from the manager, right?

    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.
  • Yes, by "delete" I mean remove in game with the Action "Inventory, Add or remove, Remove".

    I didn't have Items can be re-ordered in Menu? checked.
    If the option is checked, the problem does not appear.

    Here are the Settings screenshots:
  • OK.  I will look into it and let you know if I need more information.
  • I'm not able to recreate this with the Action sequence you've listed above.  Are you using multiple player prefabs, and what is the state of the inventory before this sequence occurs?  Can the items in question be held multiple times?

    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;
    }

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.