Version: 2017.3

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.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961