You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you so much for the post! I changed the array to a List and am now having an issue that if I output the inventory instance, the list is there, but when I try to access the List inside it, it is empty. Do you have any idea why this could be the case?
Hmmm... this could be a few different things, and it's hard to really narrow it down without seeing any code.
Is this a save/load issue? Does the inventory work normally at runtime but doesn't "remember" stuff between runs?
A good guess would be that I think List may not be serializing/deserializing the way you'd expect. Understandably when loading from JSON I think it just parses every "list of elements" as an array, and I'm not sure that there's any magical conversion there. You might have to load the JSON then transfer it into a list or something weird like that.
The best thing to do probably is to put a breakpoint in the get instance code (Inventory.cs:L11) and the save/load (`Inventory.cs:L34/L41) and take a look at the variables to see exactly where things are going wrong. Also have a look at the save file itself and make sure things are getting written out.
If it's a runtime error... I'm not sure. Make sure you've updated all the insert/etc methods to use a list as well?