Decide not to send a packet in OnPhotonSerializeView

Options
Hey,

is there a way for me to tell Photon that I want to drop the current packet that is being created in OnPhotonSerializeView?

I'm really in need of such a feature because I'm only sending information if a change has been detected. This works fine but Photon also detects a change when a state changed that is absolutely not needed to send to the client because they know about that change anyway.

I think I already tried something like that and it only did cause errors (but did not try it again in the most recent version):
[code]
stream.SendNext(...);
stream.SendNext(...);
stream.SendNext(...);

if (noImportantChangeCouldBeFound)
{
// Tell Photon to drop and not send this packet

stream = null;
return;
}
else
{
stream.SendNext(importantChange);
}
[/code]
Is this the way to go or how could it be done?

TL;DR: I want to exclude a single variable from the change detection and handle it on my own because a change does not necessary mean that I need to send the packet.

Comments

  • Dummie
    Options
    I finally could spend some more time on this and I found that stream is not just local to the called script but contains the data of all observed scripts by that PhotonView. Concluding that using ResetWriteStream will drop the whole package and not just the package being send by the script.

    That really is annoying. What I did now is that I added another PhotonView to the GameObject that is only handling this scripts. That seems to work. However it feels a bit hacky. Probably because it is.

    The better approach would probably be using a RPC but I got no clue how I can send it in a nice way. Is there any way to send it like the stream does so I can utilize SendNext and ReceiveNext?
  • Dummie
    Options
    Wrote my own type. Seems to work.