void Awake() { shameData = SaveSystem.LoadShameData(); if (shameData == null) { shameData = new ShameData(0, new List <byte[]>(), new List <string>(), new List <string>(), new List <string>()); Debug.Log("ShameData created from none"); } else if (shameData != null) { Debug.Log("Number of Shames to Load is: " + shameData.numberOfShames); LoadShameImages(); } }
public static ShameData LoadShameData() { string path = Application.persistentDataPath + "/shameBytes.dog"; if (File.Exists(path)) { BinaryFormatter bFormatter = new BinaryFormatter(); FileStream fStream = new FileStream(path, FileMode.Open); ShameData shameData = (ShameData)bFormatter.Deserialize(fStream); fStream.Close(); return(shameData); } else { Debug.LogError("Save file not found in " + path + ""); return(null); } }