

This serializer can provide a size that is close to the theoretical size. This archive introduces custom serializer which can serialize custom type such as user defined structure or class. However, it is still larger than the theoritical size of 24 bytes. The size of bytes are reduced from 94 bytes to 67 bytes. Note that Unity objects such as Vector3, Quaternion and etc are not included since those cannot be serialized by Binary Formatter. Given structure will be serialized with Binary Formatter and the size will be measured by Marshal. This archive provides custom type registering method with script and compares the difference with other serialization methods. In addition, Binary Formatter cannot serialize Unity's Vector2, Vector3, Quaternion and etc. However, Binary Formatter creates a significant amount of additional bytes, which will hurt traffic for network intensive games and give poor experience for mobile users who cannot use free WIFI connection. In many cases, byte serialization is performed using Binary Formatter. Instead, PUN2 provides custom type registering method as a solution.įor using PUN2’s custom type registering method, a custom type must be serialized into byte array. However, sending theses custom types directly to network is not allowed in PUN2. When developing multiplayer game with PUN2, there will be cases where sending custom types such as user defined structure or class through RPC and Event, etc.
