Forum rules - please read before posting.

Inventory bugged after changed scene

Hi,

After I get to the end of my first scene and are loaded into the next, my inventory seems to be bugged.

I use the WalkingDead UI from the download page and when I point the cursor to the top of the screen to show the inventory, I can see the item I had with me from the previous scene. But when I hover over the item my Console is spamming an error

NullReferenceException: Object reference not set to an instance of an object
AC.MenuInventoryBox.GetItemSlot (Int32 itemID) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInventoryBox.cs:1081)
AC.PlayerMenus.UpdateMenuPosition (AC.Menu menu, Vector2 invertedMouse) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:804)
AC.PlayerMenus.UpdateMenu (AC.Menu menu, Boolean justPosition) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:875)
AC.PlayerMenus.UpdateAllMenusAgain () (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1840)
AC.PlayerMenus.UpdateAllMenus () (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1828)
AC.StateHandler.Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:332)

And when I later call the action to remove the item from inventory after it has been used in the scene, it will not remove it from the inventory, no error messages are printed either.

I've been looking for the issue for hours >_< any ideas?

Comments

  • edited March 2017
    Sorry for the trouble.

    Have you modified the UI in any way?  The default Walking Dead interface has an inventory on the left-side of the screen?  If your Inventory Menu's Source is set to Unity Ui Prefab, does it work if you change it to Adventure Creator?

    What version of AC are you using?  The script lines you've posted do not match up with the latest release - please back up your project and upgrade to v1.56c.  It may be that this fixes the issue, but if not, the updated line numbers will allow us to debug the issue properly.
  • Hi,

    Setting the menu soruce to from Unity Ui Prefab to Adventure Creator did not help. I switched from the original inventory to the Walking Dead one, and then it is working perfectly, so it seems that the original inventory does not work well with the Walking Dead menu manager (I copied the Inventory tab from the original AC menu manager and pasted it in Walking Dead manager, I deleted the Walking Dead one before pasting the original). The reason I like the original inventory is that it has drag and drop, item combine and item interactions. 

    Im using 1.54, I havent updated because Im afraid to break the project (have happened to me before with another pack from asset store).
  • Okey so a fancy tiny update:

    I removed "Ignore mouse" click on the inventory to get drag an drop support. It works.
    But whenever I move items out of the first inventory slot and into another, I get the same error spamming the console when hovering over the item.
  • I shall issue a fix in the next release, but you can do this manually as well by editing MenuInventoryBox.cs.

    Replace line 1081:
    if (invItem.id == itemID)

    with:
    if (invItem != null && invItem.id == itemID)

    You should always back up your project when upgrading, of course, but AC's changelog file includes a set of "Upgrade notes" for each update.  These cover any changes made that you need to be aware of - see Section 1.6 of the Manual.  Of course, if anything does break, this is the place to get it taken care of.
  • Hi again, before you replied I did some experimentations and turned off "Items can be re-arranged in Menu?" And suddenly the error was gone. Now everything works perfectly. So it seems that it has something to with that option. 

    I will try to endit the MenuInventoryBox.cs as of your directions when I get back to the office, and I will post the results.
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.