1
\$\begingroup\$

In all tutorials I see that an object sends data over the network and receives the data.

For sync in the same method:

Code:

void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
        if (stream.isWriting) {
            stream.SendNext (transform.position);
            stream.SendNext (transform.rotation);
        } else {

            Debug.Log("never gets called ");

            //never gets called...

            transform.position = (Vector3)stream.ReceiveNext ();
            transform.rotation = (Quaternion)stream.ReceiveNext ();

        }
    }

But when I test my code, the lower part, where the data gets received, is never executed!

I never see the logs. But the object is SYNCHED because it is set in the inspector:

But the problem is that the object is not interpolated so it looks kind of funny.

So, I need to know how can I make the upper method to work so I can do some interpolation stuff.

\$\endgroup\$
  • \$\begingroup\$ if it is not reading it may depend on the fact that your objects (client, server, proxy) are not correctly initialized. When you instantiate a gameobject over the network you must have a rpefab for client, one or proxy and one for server. Each of those should have the networkview component initialized with the same viewid \$\endgroup\$ – Leggy7 Sep 3 '15 at 11:06
  • \$\begingroup\$ I found it. The problem is that I had to drag the script of the object into the observe field, not the object itself! \$\endgroup\$ – mirzahat Sep 3 '15 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.