SerializationException: The constructor to deserialize an object of type 'StringIntSerializableDictionary' was not found.
Hi
I'm trying to use the library to save file to disk. I'm serializing object that has 2 dictionaries using your library. I can save them without no errors but when i try open the file and deserialize I get this error from Unity 2019.2.19f1 on Win 10.
Error: SerializationException: The constructor to deserialize an object of type 'StringIntSerializableDictionary' was not found. Rethrow as SerializationException: The constructor to deserialize an object of type 'StringIntSerializableDictionary' was not found.
Here is the code for saving and opening the file:
Save to Disk code: public void saveGameToDisk (string saveGameName, thxdss gameObjectToSave) {
Debug.Log ("Start Writing File");
try
{
BinaryFormatter bf = new BinaryFormatter ();
FileStream file = File.Create (Application.persistentDataPath + "/" + saveGameName + ".dat");
gameObjectToSave.initDB = true;
bf.Serialize (file, gameObjectToSave);
file.Close ();
}
catch (Exception ex)
{
Debug.Log (ex.Message);
}
}
======================================================== Restore from Disk
public thxdss getLocalSaveGame(string saveGameName) {
thxdss localData = new thxdss();
if (File.Exists(Application.persistentDataPath + "/" + saveGameName + ".xxx"))
{
Debug.Log ("there is file...");
FileStream file = File.Open(Application.persistentDataPath + "/" + saveGameName + ".xxx", FileMode.Open);
file.Position = 0;
file.Seek(0, SeekOrigin.Begin);
BinaryFormatter bf = new BinaryFormatter();
localData = (thxdss)bf.Deserialize(file);
file.Close();
return localData ;
}
else
{
Debug.Log("No Local Save game file is found ALERT !!!");
return null;
}
}
I can provide more that if needed.
Thank you in advance !