- Home /
Unet Material color change do not work.
Hello guys, I spent 2 days on it but i could not figure out.
Now i'll try to explain what I did. I have a player object that has: Network Identity and Network Transform. Also an object that has a NetworkManager. When I connect 2 PCs. I can see both players movements. That is fine. But There are two balls in my game. One Green and one Red.
Here is the code that changes the ball's color.
public Material Right = null;
public Material Left = null;
void OnCollisionEnter(Collision collider)
{
if (collider.gameObject.name == "_RightBall")
{ randomnumb = UnityEngine.Random.Range(0, 11);
if (randomnumb >= 5)
{
Right.color = Color.red;
}
else
{
Right.color = Color.green;
}
}
}
When player hit the ball it changes its color. It works fine for both players. But when a player change ball's color, it changes for himself. Not for other players. I want all players to see the same color when a player change ball's color. I tried to add Network Identity and checked the "Local Player Authority" to my balls. But it did not work.
Thank you.
Your answer
Follow this Question
Related Questions
Lights colored like material 0 Answers
Material cant be seen until Im very close 1 Answer
Emissive Material control via script (code) 1 Answer
Color Sensing or Changing not working 1 Answer
Problem with material color change. 2 Answers