I have tried multiple techniques, but still no result. The host is able to change the color, but not for the client players. The code looks like this.
public List<GameObject> bases = new List<GameObject>();
[SyncVar]
public Texture redTexture;
[SyncVar]
public Texture blueTexture;
[SyncVar]
GameObject objID;
NetworkIdentity objNetID;
public void CheckTexture()
{
if (isLocalPlayer)
{
for (int i = 0; i < bases.Count; ++i)
{
var tempScript = bases[i].GetComponent<BaseScoreScript>();
if (tempScript.owner == "blue")
{
objID = bases[i];
CmdCheckText(objID, blueTexture);
}
}
}
}
[ClientRpc]
void RpcChangeTexture(GameObject obj, Texture text)
{
obj.GetComponentInChildren<MeshRenderer>().material.mainTexture = text;
}
[Command]
void CmdCheckText(GameObject obj, Texture texture)
{
objNetID = obj.GetComponent<NetworkIdentity>();
objNetID.AssignClientAuthority(connectionToClient);
RpcChangeTexture(obj, texture);
objNetID.RemoveClientAuthority(connectionToClient);
}