- Home /
Question by
AsPhAlT · Jun 10, 2015 at 09:26 AM ·
multiplayernetworkphotonscriptingproblemserialize
Serialize is working in debug, but it has no effect
I've got error like this:
The observed monobehaviour (PlayerController(Clone)) of this PhotonView does not implement OnPhotonSerializeView()!
my script looks like this
using UnityEngine;
using System.Collections;
public class NetworkController : Photon.MonoBehaviour {
Vector3 actPosition = Vector3.zero;
Quaternion actRotation = Quaternion.identity;
// Use this for initialization
void Start () {
}
// Update is called once per frame
public void Update ()
{
if (photonView.isMine)
{
}
else
{
transform.position = Vector3.Lerp(transform.position, actPosition, 0.3f);
transform.rotation = Quaternion.Lerp(transform.rotation, actRotation, 0.3f);
}
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
if (stream.isWriting) {
stream.SendNext (transform.position);
stream.SendNext (transform.rotation);
Debug.Log ("Serialize is sending smth");
} else {
Debug.Log ("Serializ is receiving smth");
actPosition = (Vector3)stream.ReceiveNext();
transform.rotation = (Quaternion)stream.ReceiveNext ();
}
}
}
both debugs are working. Somehow it doesnt work. What is more, I drag&dropped script to PhotonView. What I did wrong?
Comment
How does the NetworkController class you are showing us relate to the PlayerController class that's causing the issue?
PlayerController is a name of prefab. Inside i've got all the scripts + empty object with camera+nightvision
Your answer
Follow this Question
Related Questions
Photon Network Muzzleflash 0 Answers
Messages in Multiplayer 0 Answers
How to Serialize Playermovement when Player jitters? 0 Answers