public void Save() { BinaryFormatter binary = new BinaryFormatter(); FileStream file = File.Create(Application.dataPath + "/Asel.abi"); SaveManagment save = new SaveManagment(); save.HScore = GetComponent <SavedData>().HScore; save.CarSelect = GetComponent <SavedData>().selectedCar; save.Coin = GetComponent <SavedData>().Coin; // save.Volume = GetComponent<MenuManager>().Value; binary.Serialize(file, save); file.Close(); }
public void Load() { if (File.Exists(Application.dataPath + "/Asel.abi")) { BinaryFormatter binary = new BinaryFormatter(); FileStream file = File.Open(Application.dataPath + "/Asel.abi", FileMode.Open); SaveManagment save = (SaveManagment)binary.Deserialize(file); GetComponent <SavedData>().HScore = save.HScore; GetComponent <SavedData>().selectedCar = save.CarSelect; GetComponent <SavedData>().Coin = save.Coin; // GetComponent<MenuManager>().Value = save.Volume; file.Close(); } }