Hi,
I’ve got a networked game set up. 2 teams playing versus each other, depending on which team you are your mesh changes color (either blue or red). This works fine. If I change the transparency before runtime it will work properly.
But if I try to change the alpha property of a mesh it only appears transparent on the player running the game instance, not across the network.
It’s only updating the colors and not the alpha of the mesh during runtime.
Here’s the code:
//My color
public float transparency = 1f;
public MeshRenderer mRenderer;
public Vector3 colorVectorBlue = new Vector3(0, 0, 100);
public Vector3 colorVectorRed = new Vector3(100, 0, 0);
void Awake ()
{
mRenderer = transform.GetComponentInChildren<MeshRenderer>();
}
void CheckMaterial()
{
if(transform.tag == "BluePlayer")
{
networkView.RPC("UpdateMaterial", RPCMode.AllBuffered, colorVectorBlue);
}
if(transform.tag == "RedPlayer")
{
networkView.RPC("UpdateMaterial", RPCMode.AllBuffered, colorVectorRed);
}
}
//Update my color across the network
[RPC]
void UpdateMaterial(Vector3 currentColor)
{
Color finalColor = new Color(currentColor.x, currentColor.y, currentColor.z, transparency);
mRenderer.material.color = finalColor;
}
What could be causing this?