Hi everyone, I am trying to create a multiplayer game and am trying to syncronize a manterial through RPCs. now, when I call the function calling the RPC
public void SyncColor(int c)
{
Debug.Log("Sender: " + photonView.ViewID);
gameObject.GetComponent<PhotonView>().RPC("setColor", RpcTarget.All, c);
}
everything seems fine. In the unity console during runtime it logs: “Sender: 1001”
And when the RPC function gets called:
[PunRPC]
public void setColor(int c)
{
Debug.Log("Reciever: " + photonView.ViewID);
GameObject[] blocks = new GameObject[blockParent.transform.childCount];
for (int i = 0; i< blockParent.transform.childCount; i++)
blocks *= blockParent.transform.GetChild(i).gameObject;*
Debug.Log("Blocks length: " + blocks.Length);
for(int i = 0; i<blocks.Length; i++)
blocks_.GetComponent().material = blocks*.GetComponent().materials*
~~~c_
*;
Debug.Log(“Recieved stone”);
}
In the first row it should log twice as there are 2 players in the current game. it should log:
"Reciever: 1001"
"Reciever: 2001"
And instead of this it only logs
"Reciever: 1001"
I don’t know why this is happening. can anybody help?
_~~~*_