Code: Select all
public void LoadFromFile(ES3File file)
{
// destroy any child objects, we'll recreate them on map loads
UnityExtensions.SafeDestroyAllChildren(gameObject);
if (file.KeyExists("Toons"))
{
file.LoadInto<ToonState[]>("Toons", toonStates); // toonStates loads the array fine until i stop playing and after restart it's always empty
}
else
{
toonStates = new ToonState[0];
}
Refresh();
}
public void SaveToFile(ES3File file)
{
UpdateToonStates();
file.Save<ToonState[]>("Toons", toonStates);
}
Code: Select all
{"Toons":{"__type":"Villain.ToonState[],Assembly-CSharp","value":[{"ToonName":"Burly Guard","IsMale":true,"Position":{"x":31.81852,"y":21.04839,"z":0}},{"ToonName":"Burly Guard","IsMale":true,"Position":{"x":35.71773,"y":25.06328,"z":0}}]},"DayNightGameState":{"__type":"Villain.DayNightGameState,Assembly-CSharp","value":{"IsDaytime":true,"DayOfWeek":0,"HourOfDay":7,"MinuteOfDay":46,"deltaTime":0}}}