I'm new to Unity Networking as well as networking in general. I am looking to call an RPC on multiple machines, but for the RPC to do something different if the machine executing the function is not the machine that made the initial call. Consider the following C# code:
int dloc(int p, NetworkMessageInfo m) {
if (!m.networkView.isMine) {
Debug.Log ("I didn't call this!");
p = (p-1) * -1;
}
return p;
}
[RPC]
void drawCard(int p, NetworkMessageInfo info) {
p = dloc (p, info);
player[p].drawCard ();
}
Say I call the drawCard() function on one machine with 0 as the integer parameter. I would think that on that machine, p would maintain its value of 0, and on the other machine p would be reassigned 1. However, it seems both machines have p equal whatever value the host assigns p to be. What is the problem here, and how could I work around it?