Save/Load on IOS not working

Hi all,

I have been having a hard time getting an app running on IOS.

The problem comes in whenever the game saves or loads. I read I should use Environment.SetEnvironmentalVariable() in the Awake of my save/load and I have but the problem persists.

I then read in another thread that adding Environment to a link.xml might resolve it but it did not.

I have to log in to the mac I am using Xcode on remotely so I do not have easy access to it until tomorrow but I was hoping someone might know of something simple that I missed? This is the first time I am trying to get something running on IOS and a lot of these ideas are still quite new to me.

Here is the Save/Load without the SetEnvironmentalVariable in Awake since I wanted to avoid using Mono and removed it (when I tested it I did enable Mono and set it to DoNotDestroy, logs showed the function did run):

public static class SaveMaster
{

    public static void SaveLevels()
    {
        string path = Application.persistentDataPath + "save.data";
        FileStream fs = new FileStream(path, FileMode.Create);
        BinaryFormatter bf = new BinaryFormatter();
        bf.Serialize(fs, ProgressSaveScript.LevelSaveList.listOfLevels);
        fs.Close();
    }

    public static void SaveGameData()
    {
        string path = Application.persistentDataPath + "GameSave.data";
        FileStream fs = new FileStream(path, FileMode.Create);
        BinaryFormatter bf = new BinaryFormatter();
        bf.Serialize(fs, ProgressSaveScript.GameDataSave.savedGameData);
        fs.Close();
    }

    public static void LoadLevels()
    {
        string path = Application.persistentDataPath + "save.data";
        if (File.Exists(path))
        {
            using (Stream stream = File.Open(path, FileMode.Open))
            {
                var bformatter = new BinaryFormatter();

                List<ProgressSaveScript.LevelSave> tempList = (List<ProgressSaveScript.LevelSave>)bformatter.Deserialize(stream);

                ProgressSaveScript.LevelSaveList.listOfLevels = tempList;

                stream.Close();
            }
        }
    }

    public static void LoadGameData()
    {
        string path = Application.persistentDataPath + "GameSave.data";
        if (File.Exists(path))
        {
            using (Stream stream = File.Open(path, FileMode.Open))
            {
                var bformatter = new BinaryFormatter();

                ProgressSaveScript.GameDataSave.savedGameData = (ProgressSaveScript.GameData)bformatter.Deserialize(stream);

                stream.Close();
            }
        }
    }
}

Here is the link.xml:

<linker>
       <assembly fullname="System">
               <type fullname="System.Environment" preserve="all"/>
               <type fullname="System.IO" preserve="all"/>
               <type fullname="System.Runtime.Serialization.Formatters.Binary" preserve="all"/>
               <type fullname="System.Collections.Generic" preserve="all"/>            
       </assembly>
</linker>

Any help would be much appreciated!

I’d use Path.Combine(Application.persistentDataPath, "GameSave.data") instead of Application.persistentDataPath + "GameSave.data" but I don’t know if it’ll resolve the issue.