- Home /
Question by
hazel_leylak · Apr 16, 2021 at 10:14 PM ·
multiplayermaterialphotonmultiplayer-networkingmaterial color
Material color changing in Photon Multiplayer scenes
I want each player to choose a special color for themselves. I use material.SetColor ("_ Color", color) to change color and change the material color of the prefab.
When I took the material color information in Local and started the multiplayer scene, I tried checking it with PhotonView.IsMine and applying that color. But whatever color each player chose, they saw the others as the same color.
Here's my code:
void Start()
{
if (photonView.IsMine){
photonView.RPC("SetColor", RpcTarget.All);
}
}
[PunRPC]
void SetColor()
{
Color playerColor = new Color(gameObject.materials[0].color.r, gameObject.materials[0].color.g, gameObject.materials[0].color.b);
gameObject.materials[0].SetColor("_Color", playerColor);
}
Does anyone know where I went wrong? I have tried most of the methods on the forums and have definitely been unable to figure it out for days.
Thank you in advance to those who can help
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613032419im_/https://answers.unity.com/themes/thub/images/avi.jpg)