public PlayerData(AppManagerScript player) { EasyHScore = player.GetComponent <AppManagerScript>().EasyHighScore; MediumHScore = player.GetComponent <AppManagerScript>().MediumHighScore; HardHScore = player.GetComponent <AppManagerScript>().HardHighScore; ZombieHScore = player.GetComponent <AppManagerScript>().ZombieHighScore; }
public static void SavePlayer(AppManagerScript player) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/player.data"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player); formatter.Serialize(stream, data); stream.Close(); }