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! Your search result can be found below. Plus, we offer support via 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