Not clear what OnPhotonSerializeView does

Hallo

in all tutorials I see that an object sends data over the network and receives the data
for sync in the same method:

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.

Mirza

Please do the Marco Polo Tutorial. It will help you get to the “else” part of this.
If you did it like in the tutorial, it should work. If you’re then still stuck, let us know.

I did it and it helped me a lot. I understand the concepts.

The problem is that it once worked…now it is not.

The stream is only written bt one client, and it does not receive it at all!

Mirza

One client writes, the others in the same room receive.
Make sure there’s someone else in the same room. Make sure you dragged the script into the “observed” list on the prefab’s PhotonView.