I am working for a simple turn multiplayer game.
What I need is that when a player click on a button, this is sent by a server RPC that check the selection and call a client RPC. In this client RPC I need to change the color of that button.
My problem is that the button doesn’t change the color.
Here the code:
[ClientRpc]
public void SetActivePlayerClientRPC(ulong id,Matrix m)
{
table = m;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
if (m.matrix[i, j] != -1)
MatrixObject.Find(string.Format("{0}-{1}", i, j)).GetComponent<Image>().color = mapColors[ulong.Parse(m.matrix[i, j].ToString())];
}
The MatrixObject is a gameobject is found this way (in every client is the only tagged “Matrix”):
_matrixObject = GameObject.FindGameObjectsWithTag("Matrix")[0].transform;
I tryed to color the button in other points of the code and it works. I can’t understand why in this part of the code it doesn’t work.
Any ideas?
Thanks