Version: 5.5

NetworkWriter

class in UnityEngine.Networking

Switch to Manual

Description

General purpose serializer for UNET (for serializing data to byte arrays).

Variables

PositionThe current position of the internal buffer.

Constructors

NetworkWriterCreates a new NetworkWriter object.

Public Functions

AsArrayReturns the internal array of bytes the writer is using. This is NOT a copy.
FinishMessageThis fills out the size header of a message begun with StartMessage(), so that it can be send using Send() functions.
SeekZeroSeeks to the start of the internal buffer.
StartMessageThis begins a new message, which should be completed with FinishMessage() once the payload has been written.
ToArrayReturns a copy of internal array of bytes the writer is using, it copies only the bytes used.
WriteThis writes a reference to an object, value, buffer or network message, together with a NetworkIdentity component to the stream.
WriteBytesAndSizeThis writes a 16-bit count and a array of bytes of that length to the stream.
WriteBytesFullThis writes a 16-bit count and an array of bytes of that size to the stream.
WritePackedUInt32This writes the 32-bit value to the stream using variable-length-encoding.
WritePackedUInt64This writes the 64-bit value to the stream using variable-length-encoding.