Example #1
0
    public static TimeKeeper Load()
    {
        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();

            if (data.IsRightVersion(versionController))
            {
                return(data);
            }
            else
            {
                return(Reset());
            }
        }
        return(Reset());
    }