private string m_settingsFilename = Application.persistentDataPath + "/Settings.dat";
private void WriteSettingsFile()
{
FileStream filestream = new FileStream(m_settingsFilename, FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
try
{
formatter.Serialize(filestream, m_savedData);
}
catch(SerializationException e)
{
Debug.Log("Failed to save settings. Reason: " + e.Message);
}
finally
{
filestream.Close();
}
filestream.Close();
}
This works fine iOS, Android, Win, and OSX. But not WebGL. Do I need to do something different to save? I'm using Unity 5.1.4, because of problems with 5.2 and 5.3 that prevent me using them.
↧