Hi! I recently wanted to put everything in namespaces so that I could use assembly definitions. Once I updated the game, I noticed that players lost some of their progress because the type of the class I was saving changed from:
"__type" : "StageProgress,Assembly-CSharp",
to
"__type" : "StageSystem.StageProgress,Assembly-CSharp",
What is the best way to change a class's name, namespace, or assembly after we already started saving it?
Thanks!
Refactoring type names/namespaces/assemblies causes error in loading.
Re: Refactoring type names/namespaces/assemblies causes error in loading.
Hi there, and thanks for getting in contact.
This occurs because C# now considers your class a different class.
In this case you would need to do a search and replace of the save file to replace the old type with the new one. I.e.
All the best,
Joel
This occurs because C# now considers your class a different class.
In this case you would need to do a search and replace of the save file to replace the old type with the new one. I.e.
Code: Select all
string saveString = ES3.LoadRawString("SaveFile.es3");
saveString.Replace("StageProgress", "StageSystem.StageProgress");
ES3.SaveRaw(saveString, "SaveFile.es3");
Joel