When using a PooledWriter to generate data for a custom RPC (e.g., [ServerRpc], [TargetRpc]) and passing the resulting ArraySegment<byte>:
If the PooledWriter is disposed immediately after calling the RPC, is there any risk that FishNet might process/send the RPC data after the underlying buffer has been returned to the pool and potentially reused?
Does FishNet copy the ArraySegment data immediately upon the RPC method call, or does it potentially queue the segment reference? Just wondering if I need to defensively use .ToArray() on the segment before passing it to RPCs to ensure data isn't corrupted, or if FishNet's handling makes this unnecessary. Thanks!
Here's some code as an example:
this.RpcUpdateStateServer(pooledWriter.GetArraySegment(), Channel.Unreliable);
pooledWriter.Store();