예제 #1
0
 public static void LoadOptions()
 {
     if (File.Exists(Application.persistentDataPath + "/Options.pds"))
     {
         BinaryFormatter bf = new BinaryFormatter();
         FileStream file = File.Open(Application.persistentDataPath + "/Options.pds", FileMode.Open);
         optionsFile sf = (optionsFile)bf.Deserialize(file);
         file.Close();
         music = sf.music;
         sound = sf.sound;
     }
 }
예제 #2
0
    public static void SaveOptions()
    {

        BinaryFormatter bf = new BinaryFormatter();
        //Application.persistentDataPath is a string, so if you wanted you can put that into debug.log if you want to know where save games are located
        FileStream file = File.Create(Application.persistentDataPath + "/Options.pds"); //you can call it anything you want

        optionsFile sf = new optionsFile();
        sf.sound = sound;
        sf.music = music;
        bf.Serialize(file, sf);
        file.Close();
    }