Exemplo n.º 1
0
    private void save()
    {
        scorevariable sc = new scorevariable();

        sc.highscore = highscore;
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/info.dat");

        bf.Serialize(file, sc);
    }
Exemplo n.º 2
0
 private void load()
 {
     if (File.Exists(Application.persistentDataPath + "/info.dat"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/info.dat", FileMode.Open);
         scorevariable   sc   = (scorevariable)bf.Deserialize(file);
         highscore = sc.highscore;
         file.Close();
     }
 }