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