Assets/Deps/emotitron/Network/GenericNetworkExt.cs
/// <summary>
/// Write a byte array to the UNET writer without it adding a 16bit tally. Of course
/// this only is use if the size is fixed - since the reader won't know how many bytes to read on its own.
/// </summary>
/// <param name="bytesToWrite">num of bytes in the array to actually write. -1 (default) will write all.</param>
/// <returns></returns>
Write a byte array to the UNET writer without it adding a 16bit tally. Of course
this only is use if the size is fixed - since the reader won't know how many bytes to read on its own.
Write a byte array to the UNET writer without it adding a 16bit tally . Of course this only is use if the size is fixed - since the reader won ' t know how many bytes to read on its own .
public static void WriteUncountedByteArray(this NetworkWriter writer, byte[] bytes, int bytesToWrite = -1)
	{
		int numOfBytes = (bytesToWrite == -1) ? bytes.Length : bytesToWrite;
		for (int i = 0; i < numOfBytes; i++)
		{
			writer.Write(bytes[i]);
		}
	}
public static void WriteUncountedByteArray ( this NetworkWriter writer , byte [ ] bytes , int bytesToWrite = - 1 ) { int numOfBytes = ( bytesToWrite == - 1 ) ? bytes . Length : bytesToWrite ; for ( int i = 0 ; i < numOfBytes ; i ++ ) { writer . Write ( bytes [ i ] ) ; } }
Write a byte array to the UNET writer without it adding a 16bit tally.
Write a byte array to the UNET writer without it adding a 16bit tally .
None
NetworkWriter
this
bytes
byte[]
bytesToWrite
int
num of bytes in the array to actually write. -1 (default) will write all.
num of bytes in the array to actually write . - 1 ( default ) will write all .