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

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

DanieleSuppo
2022-09-19 18:05:17

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!

Comments

Tobias
2022-09-21 08:49:34

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.

DanieleSuppo
2022-09-21 15:29:53

Many thanks!

Back to top