Esempio n. 1
0
    public static void LoadGame()
    {
        string path = Application.persistentDataPath + "/savegame.hope";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            SaveGame saveGame = formatter.Deserialize(stream) as SaveGame;
            stream.Close();

            saveGame.Apply();
        }
        else
        {
            Debug.LogError("Save file not found in " + path);
        }
    }