// Start is called before the first frame update public static void SaveAvatarStats(AvatarManager mainAvatar) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/avatar.sav", FileMode.Create); AvatarStats data = new AvatarStats(mainAvatar); bf.Serialize(stream, data); stream.Close(); }
public static int[] LoadAvatarStats() { if (File.Exists(Application.persistentDataPath + "/avatar.sav")) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/avatar.sav", FileMode.Open); AvatarStats data = bf.Deserialize(stream) as AvatarStats; stream.Close(); return(data.stats); } else { Debug.Log("Nah bro"); return(null); } }