Under review

Can't Get Inventory to Work

Cr4shBarcode 11 months ago in Inventory updated by waller bean 7 months ago 6

I can't get my Inventory Module to work. Items will not add to or appear in inventory. In the sample scene, nothing appears in the merchant list. There is one error, a NullReferenceException. If anyone can instruct me how to get things working, that would be great.

Unity version:
Game Creator version:

It didn't work; nothing changed. Here is the error message.

Satisfaction mark by Cr4shBarcode 11 months ago

Unity has an internal tool that (theoretically) updates the old prefab system to the new one. The Inventory module was designed with the previous one, but we assumed the upgrading tool would do the trick.

However, seems there is a bug in their tool what prevents from correctly upgrading the prefab tool. But, there should be a solution. First of all, if you're not using the latest Inventory module, could you update it? There shouldn't be any incompatibilities.

Once you're on the latest Inventory module, click at the top tool bar and select Asset -> Reimport All. Beware that this operation can take between a few minutes up to an hour, depending on the size of your project. With just the default Game Creator package, however, it should be around 3 to 4 minutes long.

This will force Unity to run the prefab upgrade tool again. Let me know if this works or not.

Reimporting all the assets didn't work; I'm not sure why this was marked as "fixed".

Under review

I've updated a ticket and pumped the priority. I'll be working on an update next week and this is one of the things I'll be investigating asap. Not sure why this is happening, but I'll circle back as soon as I have more info.

Cr4shBarcode I've been looking at this and haven't been able to reproduce this. However, due to a Unity bug, a user suggested that the prefabs weren't correctly updated. Might it also be that the Preferences Window doesn't shop the Inventory tab?

If that's the case, could you try navigating to the Plugins/GameCreatorData/ folder, right click it and select Reimport. This will take less than a minute. Restart Unity (just in case) and it should be working. If not, please let us know.

Did not work. Again, this is my error. Please compare it to what the script is supposed to look like and tell me if mine is different somehow:

NullReferenceException: Object reference not set to an instance of an object
GameCreator.Inventory.MerchantUIManager.BuildSellerItemsUI (GameCreator.Inventory.Merchant merchant) (at Assets/Plugins/GameCreator/Inventory/Mono/UI/Managers/MerchantUIManager.cs:194)
GameCreator.Inventory.MerchantUIManager.Open (GameCreator.Inventory.Merchant merchant) (at Assets/Plugins/GameCreator/Inventory/Mono/UI/Managers/MerchantUIManager.cs:85)
GameCreator.Inventory.MerchantUIManager.OpenMerchant (GameCreator.Inventory.Merchant merchant) (at Assets/Plugins/GameCreator/Inventory/Mono/UI/Managers/MerchantUIManager.cs:121)
GameCreator.Inventory.ActionMerchantMenu.InstantExecute (UnityEngine.GameObject target, GameCreator.Core.IAction[] actions, System.Int32 index) (at Assets/Plugins/GameCreator/Inventory/Mono/Actions/ActionMerchantMenu.cs:29)
GameCreator.Core.IAction.InstantExecute (UnityEngine.GameObject target, GameCreator.Core.IAction[] actions, System.Int32 index, System.Object[] parameters) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IAction.cs:21)
GameCreator.Core.IActionsList+d__9.MoveNext () (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:107)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

Not sure what you mean with comparing the script. Did you modify it? I'm a bit lost at the moment. Your error log seems to point to some fringe code that shouldn't be causing this issues. This leads me to think that your Inventory module is not up to date. Could this be possible? Don't forget to open the Module Manager and click on the Update button after installing the latest version (as well as the latest Game Creator version).

If this doesn't work, could you send us your project (with the minimum assets)? Via WeTransfer or Google Drive to our email account. We'll take a look.