OnSerializePhotonView() not being called.

Options
Hi Everyone,

I had some Photon Code working in Unity 4, but then when I upgraded the project to Unity 5, things seemed to stop working. I have the code below, on a network mover script which is responsible for updating player position. The script extends Photon.MonoBehaviour
void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
		{
				Debug.Log ("Serializing");
				if (stream.isWriting) {
						Debug.Log ("Writing");
						stream.SendNext (transform.position);
						stream.SendNext (transform.rotation);
						stream.SendNext (spine.rotation);
						stream.SendNext (health);
				} else {
						pos = (Vector3)stream.ReceiveNext ();
						rot = (Quaternion)stream.ReceiveNext ();
						spineRot = (Quaternion)stream.ReceiveNext ();
						health = (float)stream.ReceiveNext ();
						Debug.Log ("Receiving Reading");
				}

I have also assigned the script to the observed section of the Photon View on the object. However no matter what I seem to do, the function is never called, and none of the Logs are printed into the console.

Any help would be greatly appreciated!

Comments

  • Tobias
    Options
    I don't see why it shouldn't work anymore and as far as I can see, our demos use much the same setting and are ok.
    What you could do is remove the PhotonView from the prefab and add it again. Then assign the observed script once more. Make sure the relevant objects and components are enabled.