Пример #1
0
    public void Save()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/" + SceneManager.GetActiveScene().name + ".dat");

        JackpotInternal jackpotData = new JackpotInternal();

        jackpotData.jackpot = jackpot;

        bf.Serialize(file, jackpotData);
        file.Close();
    }
Пример #2
0
    public void Load()
    {
        String filename = Application.persistentDataPath + "/" + SceneManager.GetActiveScene().name + ".dat";

        if (File.Exists(filename))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(filename, FileMode.Open);

            JackpotInternal jackpotData = (JackpotInternal)bf.Deserialize(file);
            file.Close();

            jackpot = jackpotData.jackpot;
        }
    }