public void Save3() { BinaryFormatter binary = new BinaryFormatter(); FileStream file = File.Create(Application.dataPath + "/Savegame3.dat"); SaveManagment3 save3 = new SaveManagment3(); save3.Coins = GetComponent <SavedData>().Coin; binary.Serialize(file, save3); file.Close(); }
public void Load3() { if (File.Exists(Application.dataPath + "/Savegame3.dat")) { BinaryFormatter binary = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/Savegame3.dat", FileMode.Open); SaveManagment3 save3 = (SaveManagment3)binary.Deserialize(file); GetComponent <MenuManager>().coins = save3.Coins; file.Close(); } }