#How are you supposed to deserialize
1 messages · Page 1 of 1 (latest)
What stops you from just using [Serializable] ?
I guess - have you been able to serialize other things? Is there something that is making that functionality different with Scriptable Objects?
It said I needed to CreateInstance
I just made a PlayerData class, which contains all the same data as PlayerInfo (the scriptableobject). But that also doesn't seem to work
oh maybe it does work. Hold on I'm still messing with it
Save Asset GUID: Instead of serializing the entire ScriptableObject, save its GUID.
Load Asset: Use AssetDatabase.LoadAssetAtPath to load the ScriptableObject using its GUID.``` is this relevant?
I don't know. I'm still not sure why you can't use a scriptableobject for your save data
I'm running into issues because I switched from JsonUtility to newtonsoft json
Before I was using FromJsonOverwrite and that worked fine
i use Structs for my save-data soo i dont really know much I could tell ya when using SOs
I can't get it to deserialize correctly. The json itself is correct, all t he values are right. But when I deserialize that into a class, it's all default
foreach (var json in jsons)
{
print($"{json}");
LevelCompletionInfo info = JsonConvert.DeserializeObject<LevelCompletionInfo>(json);```
public LevelCompletionInfo(int id, bool heart, bool diamond, bool club, bool spade,
int wins, int streakWins, int highScore)
{
Debug.Log($"creating levelcompletioninfo with id: {id}");
levelID = id;
heartAchieved = heart;
diamondAchieved = diamond;
spadeAchieved = spade;
clubAchieved = club;
totalWins = wins;
winStreak = streakWins;
highestAmountLeftover = highScore;
}```
That's just a regular class, not SO