- Home /
photon stream.ReceiveNext not getting the values.
hello everyone i am working on a multiplayer game which is location based game i am trying to get and send the latitude and longitude over the network but my game is only sending the data and not receiving it on every change. it only receives only when a new player joins. can anyone please tell me the solution. Here is my code.
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){ if (stream.isWriting) { stream.SendNext (loc.lat); Debug.Log ("sending"); stream.SendNext (loc.lon); }else{ lati = (float)stream.ReceiveNext (); Debug.Log ("rcveiving"); longi = (float)stream.ReceiveNext (); } }
loc is the reference object form the other class from where it is getting the latitude and longitude.
Answer by romatallinn · Nov 21, 2016 at 10:33 AM
I know you said that the data might be sent, but check that out anyway:
1) Make sure that your class derives from Photon.MonoBehaviour
2) On the object (where this class is attached), there is a PhotonView component. In the "Observed Components" list, the class is stored.