hello who help my ? my color script work on my player but other players they are black …my rpc not work pls help my here is my scipt
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SaveColor : MonoBehaviour
{
public SkinnedMeshRenderer rend;
public string[] materials1;
public string[] materials2;
public string[] materials3;
public string ColorName;
public int Paint;
public int ColorID;
public PhotonView photonView;
public float[] R;
public float[] G;
public float[] B;
public string[] items;
void Awake()
{
Paint = this.gameObject.transform.GetChild(0).GetChild(1).GetComponent<SkinnedMeshRenderer>().materials.Length;
rend = this.gameObject.transform.GetChild(0).GetChild(1).GetComponent<SkinnedMeshRenderer>();
materials1 = new string[Paint];
materials2 = new string[Paint];
materials3 = new string[Paint];
R = new float[Paint];
G = new float[Paint];
G = new float[Paint];
B = new float[Paint];
}
void Start()
{
ColorID = photonView.viewID;
ColorName = PlayerPrefs.GetString("Player");
}
private void Update()
{
for (int i = 0; i < Paint; i++)
{
materials1[i] = rend.materials[i].name + ColorName + 1;
materials2[i] = rend.materials[i].name + ColorName + 2;
materials3[i] = rend.materials[i].name + ColorName + 3;
R[i] = PlayerPrefs.GetFloat(materials1[i]);
G[i] = PlayerPrefs.GetFloat(materials2[i]);
B[i] = PlayerPrefs.GetFloat(materials3[i]);
this.gameObject.transform.GetChild(0).GetChild(1).GetComponent<SkinnedMeshRenderer>().materials[i].color = new Color(R[i], G[i], B[i]);
}
if (photonView.isMine)
{
photonView.RPC("Name", PhotonTargets.AllBuffered, this.ColorID, this.ColorName);
photonView.RPC("Color", PhotonTargets.AllBuffered, this.ColorID, (object)R, (object)G, (object)B);
}
}
[PunRPC]
private void Color( float[]R, float[]G, float[]B)
{
for (int i = 0; i < Paint; i++)
{
PhotonView.Find(ColorID).gameObject.GetComponentInChildren<SaveColor>().R[i] = R[i];
PhotonView.Find(ColorID).gameObject.GetComponentInChildren<SaveColor>().G[i] = G[i];
PhotonView.Find(ColorID).gameObject.GetComponentInChildren<SaveColor>().B[i] = B[i];
}
}
[PunRPC]
private void Name( int ColorID, string ColorName )
{
PhotonView.Find(ColorID).gameObject.GetComponentInChildren<SaveColor>().ColorID = ColorID;
PhotonView.Find(ColorID).gameObject.GetComponentInChildren<SaveColor>().ColorName = ColorName;
}
}