stream serialize v/s sendNext

i've been searching for this, but i have found none. that why I created this new topic.
The documentation of PUN is not helpful though :/

what is the difference between
[code2=csharp]stream.Serialize()[/code2] and [code2=csharp]stream.sendNext()[/code2]

they both send data...
which one is faster ? which one you recommend ?
any link/suggestion would be grateful.


  • They are just different ways to access / write the same data. Neither is considerably faster, so it's up to your preference which to use.
    I'll add some hint to the doc.
  • Tobias, could you confirm something for me. It's on this topic and it's not something I've been able to find anywhere else.

    If serialize does the same as SendNext, and can also be used in place of RecieveNext, does it know what it's doing in relation to those dependant on the state of stream.isWriting?
  • SendNext can't be used in place of ReceiveNext. Those are opposites.
    If isWriting is true, you have to write. Either Serialize(...) or sendNext(...). If isWriting is false, this client is receiving stuff written somewhere else.
    Your code for writing must match the one for reading the stream. Else, you will simply run into errors. The sent stream does carry the type per sent item but it doesn't keep you from attempting to fetch something from the stream that's not there.
Sign In or Register to comment.