Mirror Networking
Mirror.NetworkWriterPool Class Reference

Pool of NetworkWriters to avoid allocations. More...

Static Public Member Functions

static NetworkWriterPooled GetWriter ()
 
static NetworkWriterPooled Get ()
 Get a writer from the pool. Creates new one if pool is empty. More...
 
static void Recycle (NetworkWriterPooled writer)
 
static void Return (NetworkWriterPooled writer)
 Return a writer to the pool. More...
 

Detailed Description

Pool of NetworkWriters to avoid allocations.

Definition at line 8 of file NetworkWriterPool.cs.

Member Function Documentation

◆ Get()

static NetworkWriterPooled Mirror.NetworkWriterPool.Get ( )
static

Get a writer from the pool. Creates new one if pool is empty.

Definition at line 28 of file NetworkWriterPool.cs.

29 {
30 // grab from pool & reset position
31 NetworkWriterPooled writer = Pool.Get();
32 writer.Reset();
33 return writer;
34 }

◆ Return()

static void Mirror.NetworkWriterPool.Return ( NetworkWriterPooled  writer)
static

Return a writer to the pool.

Definition at line 42 of file NetworkWriterPool.cs.

43 {
44 Pool.Return(writer);
45 }