Modern games require complex data saving and networking, but common serialization methods like XML/JSON and BinaryFormatter can result in large amounts of unused bits. BitPacker solves this problem by tightly packing data, utilizing every bit to the fullest, and resulting in the smallest possible outputs. It has been battle-tested for performance and ease of use, and is currently used in multiple big productions.
Highlights:
- Easy to use read/write API
- Fully featured serializer that supports many of Unity's built-in types
- Intelligent integer and string packing and quaternion optimizations
- Powerful arguments to help shrink data size
- Detailed examples with line-by-line comments
- Includes full source code
BitPacker includes three main tools:
- BitSerializer: A fully featured serializer that squeezes preexisting data classes into as few bits as possible.
- BitWriter: A class that allows you to write data to any Stream or preexisting byte array.
- BitReader: A class that reads data back out from a Stream or preexisting byte array.
These tools are designed to help you optimize your network messages and data storage, and are easy to use and understand.
BitSerializer:
- Built on top of BitWriter and BitReader
- Supports a wide range of built-in types, including integers, Booleans, bytes, strings, Vector3, Quaternion, and Guid
- Automatically squeezes preexisting data classes into as few bits as possible
BitWriter:
- Allows you to write data to any Stream or preexisting byte array
- Provides a wide range of convenient methods for laying down data
- Supports writing to any type of data
BitReader:
- Reads data back out from a Stream or preexisting byte array
- Supports reading from any type of data
- Compliments BitWriter for reading and writing data





