Пример #1
0
    // Retrieve high score from file
    public static float[] LoadTimes()
    {
        if (File.Exists(Application.persistentDataPath + nameOfSaveFile))
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            FileStream      fileStream      = new FileStream(Application.persistentDataPath + nameOfSaveFile, FileMode.Open);

            TimeKeeper data = binaryFormatter.Deserialize(fileStream) as TimeKeeper;

            fileStream.Close();
            return(data.GetTimes());
        }
        else
        {
            return(ResetTimes());
        }
    }