Basically when the save function is called it only seems to save the InsanceIds to the json file please see attached save.txt file (maybe on a separate post due to upload limit).
alt text
when I do a Debug.Log, if I type just wrap I just get a JobManagerWrapper object, if I type wrap.array then I get JobManager, if I type wrap.array[0] then I get Job1[jobManager]
Please see attached screenshots for breakpoints results from the save.alt text (have to put the 2nd in a separate post as it wont allow me to add anymore attachments).
On Loading its passed all the instanceIDs that are in the save.txt, when I do a Debug.Log(j.array[0].jobStatus)) it’s set to 0 and it should be 1 as in the save before that’s what it was set to.
public static void Save()
{
JobManagerWrapper wrap = new JobManagerWrapper();
wrap.array = Resources.LoadAll<JobManager>("Jobs");
string jsonData = JsonUtility.ToJson(wrap);
File.WriteAllText(Application.persistentDataPath + "/save.txt", jsonData);
}
public static void Load()
{
if (FileCheck())
{
string jsonData = File.ReadAllText(Application.persistentDataPath + "/save.txt");
JobManagerWrapper j = JsonUtility.FromJson<JobManagerWrapper>(jsonData);
Debug.Log(jsonData);
}
else
{
Debug.LogError("Save file not found");
}
}
public class JobManagerWrapper
{
public JobManager[] array;
}
Thanks