Page 1 of 1

Refactoring type names/namespaces/assemblies causes error in loading.

Posted: Sat Jun 18, 2022 2:32 pm
by dlees9191
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!

Re: Refactoring type names/namespaces/assemblies causes error in loading.

Posted: Mon Jun 20, 2022 9:17 am
by Joel
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.

Code: Select all

string saveString = ES3.LoadRawString("SaveFile.es3");
saveString.Replace("StageProgress", "StageSystem.StageProgress");
ES3.SaveRaw(saveString, "SaveFile.es3");
All the best,
Joel