I have two issues with my saving system, hope you can help me on this
# ISSUE 1
I have a PlayerData ScriptableObject that contains other nested ScriptableObjects.
I can't save the children, ES3 just saves me the first one and the nested ScriptableObjects are not saved.
Here are my objects :
Code: Select all
public class PlayerData : ScriptableObject
{
public string nickname = "player";
public int score;
public string noSave;
public ItemData[] items;
public WorldsData worlds;
}
Code: Select all
public class ItemData : ScriptableObject
{
public string title;
public bool owned;
}
Code: Select all
public class WorldsData : ScriptableObject
{
public WorldData[] worlds;
}
Code: Select all
public class WorldData : ScriptableObject
{
public LevelData[] levels;
}
Code: Select all
public class LevelData : ScriptableObject
{
public string title = "newLevel";
public int money;
// These have to be saved
public bool playerVictory;
public int playerScore;
public int playerScraps;
}
Code: Select all
{
"player":
{
"__type": "PlayerData,Assembly-CSharp",
"value":
{
"_ES3Ref": 5364206003884784654,
"nickname": "Toto",
"score": 500,
"items": [
{
"_ES3Ref": 8329346111485538119,
"owned": false
},
{
"_ES3Ref": 5534608772170016919,
"owned": false
}],
"worlds":
{
"_ES3Ref": 1311634918222638909
}
}
}
}
Code: Select all
{
"player":
{
"__type": "PlayerData,Assembly-CSharp",
"value":
{
"_ES3Ref": 5364206003884784654,
"nickname": "Toto",
"score": 500,
"items": [
{
"_ES3Ref": 8329346111485538119,
"owned": false
},
{
"_ES3Ref": 5534608772170016919,
"owned": false
}],
"worlds":
{
"_ES3Ref": 1311634918222638909
"worlds" :
[
{
"_ES3Ref": 000000000-some-id
"levels" :
[
{
"_ES3Ref": 000000000-some-id,
"playerVictory" : false,
"playerScore" : 0,
"playerScraps": 0
},
{
"_ES3Ref": 000000000-some-id,
"playerVictory" : false,
"playerScore" : 0,
"playerScraps": 0
}
]
},
{
"_ES3Ref": 000000000-some-id
"levels" :
[
{
"_ES3Ref": 000000000-some-id,
"playerVictory" : false,
"playerScore" : 0,
"playerScraps": 0
},
{
"_ES3Ref": 000000000-some-id,
"playerVictory" : false,
"playerScore" : 0,
"playerScraps": 0
}
]
}
]
}
}
}
}
When I load my saved game, the inspector shows me wrong info or empty fields
Here is my inspector before loading of the save :
Here is my inspector after loading :
Can you help me with this please ?
Thanks !