Unified SaveLoad methods
In MSCLoader 1.2.8+ there is a new method to store your saved stuff, based on feedback from other modders it brigs a unified save location for all mods into a signle file.
Best part is you don't need to trash your current save system, instead of saving your current save to file, you can save and load it as byte[]
array into this new save method.
bool testBool = false;
int testInt = 395352;
Vector3 testVector = new Vector3(34f, 0, 12.5f);
List<string> testList = new List<string>() { "test1", "test2", "test3" };
//OnSave
SaveLoad.WriteValue(this, "testBool", testBool);
SaveLoad.WriteValue(this, "testInt", testInt);
SaveLoad.WriteValue(this, "testVector", testVector);
SaveLoad.WriteValue(this, "testList", testList);
//OnLoad
bool readBool = SaveLoad.ReadValue<bool>(this, "testBool");
int readInt = SaveLoad.ReadValue<int>(this, "testInt");
Vector3 readVector = SaveLoad.ReadValue<Vector3>(this, "testVector");
List<string> readList = SaveLoad.ReadValueAsList<string>(this, "testList");
valueID - valueID needs to be uniqueID for your mod, you can read value stored under that ID using ReadValue
methods
There is new method to serialize custom class int unified save file. To serialize your class just add in OnSave
SaveLoad.SerializeClass(this, myClassToSerialize, "mySerializedClass");
To deserialize your class just do in OnLoad
MyClass myClass = SaveLoad.DeserializeClass<MyClass>(this, "mySerializedClass");
In SerializeClass
there is optional parameter to "encrypt" your data.
If you decide to do it you need to also set optional parameter to true
in DeserializeClass
If you already have custom save method, you can also save that file into unified save file.
If your current save file is in binary format it's recommended to save it as byte[]
array
Examples:
SaveLoad.WriteValue(this, "mySaveFile", myByteArray);
To Load it:
byte[] myByteArray = ReadValueAsArray<byte>(this, "mySaveFile");
SerializeSaveFile
and DeserializeSaveFile
methods, serializes file to custom .json file
- How to install MSCLoader using MSCPatcher
- MSCPatcher explained
- How to install mods
- Official experimental linux support
- Unofficial tutorial for linux (wine/proton)
- Install Visual Studio for MSCLoader
- Install template for Visual Studio
- How to use templates
- Debugging your mods in Visual Studio
- Enable DevMode to help with debugging
- Uploading and creating Self update feature for your mod or reference
- All Playmaker Global Variables and Events
- How to create and use Asset Bundles