stream.sendNext() without OnPhotonSerializeView

Is it possible to send data without putting it in OnPhotonSerializeView and using RPC?


  • if that's not possible, is there any way to increase the rate at which OnPhotonSerializeView is called?
  • You can use RPCs and you could also go a level lower and use PhotonNetwork.networkingPeer.OpRaiseEvent.
    You can also increase the rate with which OnPhotonSerializeView gets called. Check PhotonNetwork.sendRateOnSerialize and .sendRate.

    What do you want to achieve?
  • I have some data to send for a photonView but it is done rather infrequently. As a result, it would be best if i could control when exactly i send them. Using RPC seems to be a perfect fit, but from tests it seems to be slightly slower than using stream.sendNext(). Consequently, i have OnPhotonSerializeView poll if i have data to send (which isn't elegant but at least it's faster).

    Increasing the send rate solved my problem, but may i know what is the difference between .sendRateOnSerialize and .sendRate? Thanks a ton!
  • In best case, you'd NOT increase the send rate but trigger a send when you called an RPC. This is what we do for OnPhotonSerializeView but there we know when we called all serialize methods and are actually ready to send stuff.
    To actually send any RPCs at the end of the Update call: PhotonNetwork.SendOutgoingCommands().
    Do this only if you actually called RPCs.