#SerializableDictionary but with tuple

1 messages Β· Page 1 of 1 (latest)

idle mason
#

okay! here it goes

torpid temple
#

Big logs? πŸ˜›

#

Just so you know, I need to go in 35 minutes.

idle mason
torpid temple
#

FileDataHandler:Load(String, Boolean) (at Assets/Scripts/DataPersistence/FileDataHandler.cs:54)

#

Not in here?

torpid temple
torpid temple
#

That changes things.

#

Nevermind, you feed the JsonUtility OnAfterDeserialize()

#

Why do you do this? @idle mason

idle mason
#

it was in the guide I was following, by the way, in the original code there is no such error on load

#

so it still must be something magical with my tuple dictionary

torpid temple
#

Are you sure you are saving it correctly?

#

Then Load wouldn't be the problem

torpid temple
#

I have no idea what it is clearing at the moment, it might as well be the first list.

#

Seems you clear the whole dictionary to be honest πŸ€”

#

Can you debug.log

#
                // deserialize the data from Json back into the C# object
                loadedData = JsonUtility.FromJson<GameData>(dataToLoad);

the dataToLoad

idle mason
# torpid temple ```cs // deserialize the data from Json back into the C# object ...

My data to load is: {
"lastUpdated": -8585395643272775952,
"deathCount": 0,
"playerPosition": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"stepsCount": 0,
"coinsCollected": {
"keys": [],
"values": []
},
"objectsActivated": {
"keys": [
"f62f2e92-5307-48e3-886a-d9d96f2d1106"
]
},
"playerAttributesData": {
"vitality": 1,
"strength": 1,
"intellect": 1,
"endurance": 1
}
}

torpid temple
#

No values

#

So the saving is the problem

torpid temple
idle mason
#

you mean gamedata data?

torpid temple
#

DataToStore

idle mason
# torpid temple DataToStore

And my dataToStore is: {
"lastUpdated": -8585395627012210439,
"deathCount": 0,
"playerPosition": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"stepsCount": 0,
"coinsCollected": {
"keys": [],
"values": []
},
"objectsActivated": {
"keys": [
"f62f2e92-5307-48e3-886a-d9d96f2d1106"
]
},
"playerAttributesData": {
"vitality": 1,
"strength": 1,
"intellect": 1,
"endurance": 1
}
}

torpid temple
#

So that's also missing the values of "objectsActivated"

#

Figure out why that is and your problem is solved πŸ‘

idle mason
torpid temple
#

No, I'm gone at least for a couple of hours. Going from work, shop, cooking, eating, gym, then maybe if I have more energy I open discord.

idle mason
#

Okie!! Will wait for you here and if I find a solution I will tell, okay?

torpid temple
#

But I think if you put this question in #archived-code-general with this information why the values don't save you might get some help there

#

Yeah, ill see tomorrow for sure, maybe later tonight too, will see.

#

πŸ‘‹

idle mason
#

goodbye!

idle mason
idle mason
torpid temple
idle mason