Syncing Parent and Child Data

Options
Hello, I have a class like the following:
public class Projectile: MonoBehaviourPun, IPunObservable

Rigidbody rb;

Vector3 networkVelocity;
Vector3 networkAngularVelocity;

void Awake() {
            rb = GetComponent<Rigidbody>();
}

void FixedUpdate() {
if (photonView.IsMine)
        {
            networkVelocity = rb.velocity;
            networkAngularVelocity = rb.angularVelocity;
        }
        else
        {

            rb.velocity = Vector3.Lerp(rb.velocity, networkVelocity, NetworkManager.interpolationRate);
            rb.angularVelocity = Vector3.Lerp(rb.angularVelocity, networkAngularVelocity, NetworkManager.interpolationRate);

        }
}

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        stream.Serialize(ref networkVelocity);
        stream.Serialize(ref networkAngularVelocity);
    }

This class works as intended, syncing its movement over the network through its rigidbody data. I then need a child class of this class that sends velocity and angular velocity the same exact way, but adds an extra float to be serialized. I've tried many different routes, but can't figure out how to go about this. If I try to just re-use the code and just do exact same thing with OnPhotonSerializeView and FixedUpdate in the child class with the addition of the new float, Photon tells me that I can't serialize the same items across child and parent class. Any advice?

Comments

  • Tobias
    Options
    Which version of PUN 2 do you use and what is the exact error? Please quote and include the callstack.
    This makes it easier to identify the cause.