Im not sending my position if it is the same and at that time the client on the other side doesnt try to receive anything. Transform.position = (Vector2)stream.ReceiveNext() If (stream.IsWriting & photonView.IsMine)Įlse if (stream.IsReading & !photonView.IsMine) If ((Vector2)transform.position = SentPosition) Public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) Here is the code of the script that is working (this is the only script being observed) The photon view's setting is on reliable data compressed. When I am observing only one script it works exactly how I want it to (the receiver's OnPhotonSerializeView is called whenever the sender sends something) but when I observe multiple scripts the receiver keeps trying to read the stream even if the sender has not sent anything so I get the IndexOutOfBounds exception. Hello, I am trying to save bandwidth and reduce network traffic by only sending messages over OnPhotonSerializeView when necessary.
0 Comments
Leave a Reply. |