By default, Databrain uses the Newtonsoft Json library to serialize the data to a json file. It is possible though to serialize the data with a custom serializer such as Odin Serializer.
Simply use the API methods GetSerializableData and SetSerializedData.
Here's a simple example using Odin Serializer:
usingOdinSerializer;// The data librarypublicDataLibrary data;publicvoidSave(){ // Get the serializable data class from the data libraryvar serializableData =data.GetSerializableData(); // Use Odin Serializer to serialize the databyte[] bytes =SerializationUtility.SerializeValue(serializableData,DataFormat.Binary); // Write to a fileSystem.IO.File.WriteAllBytes(System.IO.Path.Combine(Application.persistentDataPath,"saveFile.data"), bytes);}publicvoidLoad(){ // Load the file as bytes byte[] bytes = System.IO.File.ReadAllBytes(System.IO.Path.Combine(Application.persistentDataPath, "saveFile.data"));
// Deserialize the data using Odin Serializer var serializableData = SerializationUtility.DeserializeValue<DataLibrary.JsonSerializeableClass>(bytes, DataFormat.Binary);
// Set the data back to the data library. // This will load the complete data and also calls the OnLoaded event.data.SetSerializedData(serializableData );}