binary serialization in c#

I'm looing for solution how to serialize and de serialize binary data. I want to use BJON (Binary JSON), but i can change my decision, so i found that solution - . Is it works in unity or now? What you can recommend me for me?

Or if you are willing to decorate the objects you are serializing with attributes, and you're not serializing anything stored as just "object", you could try protobuf-net (Google Protocol Buffers). It is faster and serialized objects take up less space than using BinaryFormatter.

You should look into the .NET-specific class BinaryFormatter (MSDN). It will binary-serialize any `ISerializable` object for you.

Also if you want to serialize Unity objects you can try using ISerializationSurrogate

I used it to serialize MonoBehaviours as they dont need to be created when you deserialize. You just serialize the name( or unique id ) of the game object that owns your MonoBehaviour script and then use GameObject.Find when you deserialize.

GameObject Serializer Pro is built on top of protobuf-net, and includes many of the common surrogates need to serialize Components like Transform, and even entire GameObjects (This is not normally what you want unless you are creating procedural content).

Even if you are not creating procedural content, using the support for primitive types like Vector3 and Quaternion can save a lot of work.