public void Load() { if (File.Exists(Application.persistentDataPath + "/challengeInfo.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/challengeInfo.dat", FileMode.Open); AvailableChallengeButtons data = (AvailableChallengeButtons)bf.Deserialize(file); file.Close(); bools = data.bools; star_Two = data.star_Two; star_Three = data.star_Three; } }
public void Save() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/challengeInfo.dat"); AvailableChallengeButtons data = new AvailableChallengeButtons(); data.bools = bools; data.star_Two = star_Two; data.star_Three = star_Three; bf.Serialize(file, data); file.Close(); }