Does anyone have working examples of AddInventoryItemAsync? My current code can successfully retrieve the Inventory Item definition but returns a 404 error when i try to call AddInventoryItemAsync()
Hi there,
Thanks for taking the time to post this.
Could you share what packages you have included for economy within you manifest file?
A screenshot of the Package Manager would work great. You can access the Package Manager by going to your Unity Editor and clicking on Window > Package Manager.
We have a known issue at the moment that points to an older version of a dependent package. This should be fixed in the next version of Economy.
Unfortunately the workaround did not work for me. Just due to the fact that I am able to retrieve the InventoryItemDefinition I think we can rule out a configuration issue.
Any other potential workarounds or is the best bet just to wait for a patch?
Hi again, thanks for the screenshot and update.
When possible could you check your project folder / Packages / packages-lock.json
Search for Remote-Config
What version do you have located?
Additionally can you proceed to Project Folder / Library / Package Cache
And verify what version you have located in that folder?
Thanks for that additional detail.
It may look like we have to wait for a new release of economy for this fix. I will continue investigating and get back to you as soon as possible.
I’m having the exact same problem, with the same code - but only for new inventory items. I added a new item last night, but when I try to AddInventoryItemAsync, 404. GetInventoryItemAsync works fine and returns the item.
I downloaded the sample, same issue. It will list all my inventory items (old and the new one). But ‘Add Item To Inventory’ only works on the items added prior to last night, not my new item.
Our engineers are investigating something that may be related to the issues you have run into. Can I ask you to try something and let us know if it resolves your issues?
Can you try resetting the playerID. We are specualting that the issue might be related to configuration caching.
You can force the playerID to reset by clearing the session token and signiing out of the Authentication service.
Actually, it appears fixed today. Did they make changes on the backend? The 404 just stopped, and that item now shows up in my Inventory. I’ve tested via Editor and a device.
Delighted to hear that it appears to be working for you today @mhardy , I’ve forwarded the information to my engineering colleagues.
Your experience does lend weight to their theory about a bug in the configuration caching. We think your cache has now naturally exprired and a new updated configuratoin was pulled when you ran the code yesterday, so the underlying bug is still there, but we now have more to go on and are actively investigating it.
Thanks for your help, I’ll update this thread when I have more news to share.
We have now identified the source of this issue and are working on a fix. I can confrim that the reason @mhardy 's issue resolved itself was because the player’s cache invalidated itself naturally after 24 hours.
The scenario is as follows:
The player interacts with economy
Their economy configuration is changed on the dashboard and published
The player retrieves a new configuration (within 24hr from initial interaction)
The player interacts with economy but the service uses their old configuration in the background
The problem doesn’t always occur, but we have been able to reproduce it in testing.
It is also important to note that there is a natural delay between steps 3 & 4 above (our tests suggest 100ms - 2s), while the cache is updated to the latest values. So there is a chance that new items added to the configuration since the last interaction might not be immediately available, so a delay between retrieving the configuration and interacting with the player inventory would be prudent.
Appreciate the patience and hard work in dealing with this issue.
Happy to report I’ve had word that the issue has been resolved. Can folks experiencing it here confirm it’s all good now?
We have published an Experimental update that resolves the caching issue described in this thread. We will keep an eye on the experimental update for a couple of weeks to check there are no further issues before moving it to Preview.
Warning, there are some breaking changes in this experimental release, you will need to change the namespace and update some API calls as we have moved things around a bit to bring more consistency across UGS packages. You may also need to update other UGS packages in your project. Take a look at the Changelog in the Package manager for each impacted package for more information on specific changes.
You can access the new experimantal Economy package from the Package Manager in the Editor or by updatng your Packages/manifest.json to use "com.unity.services.economy": "2.0.1-exp.2"