i’m trying to sync Light color between player
always i got error
Exception: cannot serialize(): UnityEngine.Color
ExitGames.Client.Photon.Protocol16.Serialize
i did like this
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(PhotonView))]
public class LightColorNetwork : Photon.MonoBehaviour
{
public Light HeadLights;
private Color LightColor;
public void FixedUpdate ()
{
// If we are not owner receive all inputs from server.
if (!photonView.isMine)
{
HeadLights.color = LightColor;
}
private void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
{
// Sending all inputs to server.
if (stream.isWriting)
{
stream.SendNext(HeadLights.color);
}
else
{
LightColor = (Color)stream.ReceiveNext();
updateTime = Time.time;
}
}
}
Thanks in advance for any help!