///////////////////////////// /// public void Save4() { BinaryFormatter binary = new BinaryFormatter(); FileStream file = File.Create(Application.dataPath + "/Savegame4.dat"); SaveManagment4 save4 = new SaveManagment4(); save4.index = GetComponent <MenuManager>().index; binary.Serialize(file, save4); file.Close(); }
public void Load4() { if (File.Exists(Application.dataPath + "/Savegame4.dat")) { BinaryFormatter binary = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/Savegame4.dat", FileMode.Open); SaveManagment4 save4 = (SaveManagment4)binary.Deserialize(file); GetComponent <SavedData>().Globalindex = save4.index; file.Close(); } }