Doloro GDK 22 .1.0 Beta
by Tauri Interactive
Serialization Tools


DDM ST is a growing module that exists to simplify cross-session work with a data both in editor and during runtime.

Use cases

Serialization process is a way to convert a runtime object to a data set that can be restored back to the same object using deserialization.

This useful at any stage of any development:

Stage Case
Editor Serialization of complex object and saving its data in binary arrays is
an easiest way to work with custom editor solutions avoiding
using of rough features of
UnityEditor.SerializedObject and UnityEditor.SerializedProperty
those have a lot of limits and tend to lose a changed data in any inaccurate way of use.
Runtime Serialization\Deserialization process is a most easy way to clone objects.
Cross-session Serialization\Deserialization is a most useful way to
save \ load game session data avoiding manual
streaming of a unstructured data to a file.

Binary Serialization Tool


The tool that allows to serialize/deserialize object in binary format.


  • Allows data loading to an object with changed members.
    1. Removed members avoiding.
    2. New members initialize with pre-defined or default values.
  • Encapsulates serialization\deserialization process to single line calls.

Exmplore API: Doloro.DataManagement.Serialization.BinarySerializationTool

How to ...

Create supportive class

Implement to your class System.Runtime.Serialization.ISerializable interface.

class YourCalss : System.Runtime.Serialization.ISerializable
// Allows to binary serializer instantiate the object from binary.
public YourClass(SerializationInfo info, StreamingContext context)
Doloro.DataManagement.Serialization.BinarySerializationTool.OverrideInstanceData(this, info);
// Calling by binary serializer to get object's data.
public void GetObjectData(SerializationInfo info, StreamingContext context)
if (info == null)
throw new System.ArgumentNullException("info");
Doloro.DataManagement.Serialization.BinarySerializationTool.ToBinary(this, info);

Serialize (save data)

Send your object to the most suitable Doloro.DataManagement.Serialization.Serialize method.

Following example demonstrates serialization process for the compatible object created by following instruction provided at the Create supportive class section.

The example works within runtime memory. But tool also allows you to work with streams and file system.

OBJ_TYPE ORIGIN_OBJ = ... // Initializing the object.
using DataManagement.Serialization;
BinarySerializationTool.Serialize(ORIGIN_OBJ, out byte[] BINARY_DATA);
Member Meaning
OBJ_TYPE Type of the object that will be serialized.

| ORIGIN_OBJ| | A serializable object. | | BINARY_DATA | A data array received represents the object in binary format. |

Deserialize (load data)

Send binary data path to the Doloro.DataManagement.Serialization.Deserialize method and get decoded object.

Following example demonstrates deserialization process of the serialized object created at the Serialize (save data) step.

using DataManagement.Serialization;
OBJ_TYPE loadedObj = null;
// Reading an object from binary container
// and tries to handle it as the `OBJ_TYPE`
loadedObj = BinarySerializationTool.Deserialize<OBJ_TYPE>(BINARY_DATA);
catch (SerializationException ex)
catch (System.Exception ex)
// Unexpected exception.
// Handle cases may be faced at your environment here.

Apply a binary formatter

During source modification you may face incompatibility of serialized data with a new object structure.
By default, BST handles such compatibility issues automatically, but for advanced task you may like to handle the process manually.

BST leaves you a way to handle your data as you wish. For this during deserialization you may add a


Binary formater using deserialization provided with following BinarySerializationTool members.

  • object Deserialize(byte[] data, BinaryFormatter formatter)
  • object Deserialize(string fullPath, BinaryFormatter formatter)
  • object Deserialize(Stream stream, BinaryFormatter formatter)


You may find an example of BinaryFormatter using at the official MS supplied documentation.