Got a quick question here.
I have defined a dictionary in an auto-loaded singleton (ProgressData). This dictionary keeps track of the player's inventory. This variable is declared on top of the script like so:
When I loot a chest, that dictionary gets a new key with all the variables of that particular item. This happens in an instance in the scene tree, like so. (it basically copies the dictionary entry from loot chest's dictionary into the inventory dictionary.
ProgressData.inven_data[counter] = loot_dic[extra_arg_0]
When the loot panel is closed the dictionary is saved to json. Based on the json and using the print command I can see this all works great.
Now the issue comes when I open my inventory after I looted a chest. I populate my inventory based on ProgressData.inven_data like so (note that my node names are identical to the dictionary keys.)
bunch of code to populate text fields and set texture for icon etc.
I know my code underneath this line works because when I open my game my inventory populates without error from the loaded json file. However, when I open my inventory after looting a chest in a game session, my inventory does not include the items I just looted. If I loot a chest, close the game, open it, and then open my inventory the items I looted in the previous game session ARE in my inventory.
So it seems that the variable inven_data in my singleton ProgressData does not update during the game session. Although the same variable is used within that singleton to safe my game successfully. It is almost as if two versions of that variable exist(??)
PS I hope this all makes sense, I didn't want to copy-paste huge code snippets. It is my first question in these forums and I hope I have formatted correctly.