PhotonView.ExecuteComponentOnSerialize C# (CSharp) Method

ExecuteComponentOnSerialize() protected method

protected ExecuteComponentOnSerialize ( Component component, PhotonStream, stream, PhotonMessageInfo, info ) : void
component Component
stream PhotonStream,
info PhotonMessageInfo,
return void
    protected internal void ExecuteComponentOnSerialize(Component component, PhotonStream stream, PhotonMessageInfo info)
    {
        IPunObservable observable = component as IPunObservable;
        if (observable != null)
        {
            observable.OnPhotonSerializeView(stream, info);
        }
        else if (component != null)
        {
            MethodInfo method = null;
            bool found = this.m_OnSerializeMethodInfos.TryGetValue(component, out method);
            if (!found)
            {
                bool foundMethod = NetworkingPeer.GetMethod(component as MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out method);

                if (foundMethod == false)
                {
                    Debug.LogError("The observed monobehaviour (" + component.name + ") of this PhotonView does not implement OnPhotonSerializeView()!");
                    method = null;
                }

                this.m_OnSerializeMethodInfos.Add(component, method);
            }

            if (method != null)
            {
                method.Invoke(component, new object[] {stream, info});
            }
        }
    }