NetworkSerializationHelpers

Description
This file contiains a set of helper methods and structs which allows you to serialize NetworkPlayer and NetworkViewID values.

SerializableNetworkViewID
The SerializableNetworkViewID struct simply holds the same raw values as the NetworkViewID struct but is marked as "Serializable". That allows you to serialize NetworkViewIDs for example in a BinaryFormatter. The struct has two implicit casting operators which makes it easy to convert one to the other.

SerializableNetworkPlayer
The SerializableNetworkPlayer struct does the same as the SerializableNetworkViewID struct but for serialiting NetworkPlayer values. A NetworkPlayer consists actually just of a single int value, however this class makes it easier to use the conversion methods.

BinaryReader / BinaryWriter extension
Besides the two structs there are also extension methods for the BinaryReader and BinareWriter class to allow the serializing / deserializing of NetworkPlayer and NetworkViewID values.

NetworkSerializationHelpers class
This class contains all the extension methods mentioned above and all the conversion helpers which use reflection to read and write the internal field(s) of NetworkPlayer and NetworkViewID values.

Usage
All classes / structs are placed in a namespace called "NetworkSerialization". To use the extension methods or serializable versions of NetworkPlayer and NetworkViewID you have to add a using statement at the top (import for UnityScript)

IMPORTANT
This class uses reflection to read and write the internal fields of Unity's NetworkPlayer and NetworkViewID struct. The internal naming of those fields or the way those values are handled can change at any time. So use at your own risk.