public void loadMoarData() { if (File.Exists(Application.persistentDataPath + "/save001.dat")) { BinaryFormatter formatter = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/save001.dat", FileMode.Open); MoarSaveData data = (MoarSaveData)formatter.Deserialize(file); obtainedGifts = data.obtainedGifts; file.Close(); } }
public void saveMoarData() { BinaryFormatter formatter = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/save001.dat", FileMode.Create); MoarSaveData data = new MoarSaveData(); data.obtainedGifts = obtainedGifts; formatter.Serialize(file, data); file.Close(); }