stream.SendNext / stream.ReceiveNext - how do them work in multiple scripts?

Hello, I'm totally new to Photon.Pun2, so maybe my question is quite silly.

I'm just looking at the official tutorials, and it seem that the best way to send/receive values on the network is using "stream.SendNext" and "stream.ReceiveNext".

It seem to me a bit unreliable, because I could have an async function, or something like that, so how can I be sure that the receivers will get the right serialized object?

In my basic idea (so far) if my player stream 10 bools, from 10 scripts, what could happen on the other players when they receive them??

Is there, for example, a way to give a name to the streams, or a better reliable way?

Many thanks!

Best Answer

  • Tobias
    Tobias admin
    Answer ✓

    The PUN Basics Tutorial is the official one.

    Networked objects are identified by the PhotonView viewID. Streams written by one object will be passed to an object with the same viewID.