Esempio n. 1
0
 public void LoadData()
 {
     //Data is loaded
     if (File.Exists(Application.persistentDataPath + "/ganeInfo.dat"))
     {
         BinaryFormatter BinForm = new BinaryFormatter();
         FileStream      file    = File.Open(Application.persistentDataPath + "/ganeInfo.dat", FileMode.Open);
         DataPref        data    = (DataPref)BinForm.Deserialize(file);
         file.Close();
         highScore = data.highScore;
     }
 }
Esempio n. 2
0
//Awake happens before start
    void Awake()
    {
        if (dataManagement == null)
        {
            DontDestroyOnLoad(gameObject);
            dataManagement = this;
        }
        else if (dataManagement != this)
        {
            Destroy(gameObject);
        }
    }