UnityEngine.Networking.NetworkWriter.WriteBytesFull C# (CSharp) Method

WriteBytesFull() public method

This writes a 16-bit count and an array of bytes of that size to the stream.

public WriteBytesFull ( byte buffer ) : void
buffer byte Bytes to write.
return void
        public void WriteBytesFull(byte[] buffer)
        {
            if (buffer == null)
            {
                this.Write((ushort) 0);
            }
            else if (buffer.Length > 0xffff)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("NetworkWriter WriteBytes: buffer is too large (" + buffer.Length + ") bytes. The maximum buffer size is 64K bytes.");
                }
            }
            else
            {
                this.Write((ushort) buffer.Length);
                this.m_Buffer.WriteBytes(buffer, (ushort) buffer.Length);
            }
        }

Usage Example

Exemplo n.º 1
0
 public override void Serialize(NetworkWriter writer)
 {
     writer.Write(proxyId);
     writer.Write((short)packet.Compression);
     writer.Write(packet.Length);
     writer.WriteBytesFull(packet.Data);
 }
All Usage Examples Of UnityEngine.Networking.NetworkWriter::WriteBytesFull