Hello …
I have two local players (client-server) and i need to execute a method on the client scene and return the value to the server scene… the scenario goes like this … the client throw a card and end his turn > the name of the card send to the server as string .
This script execute on the server ! but i need it to execute it on the client and the value (only) returned to the server .
if (Network.peerType == NetworkPeerType.Client)
{
GUI.Label(new Rect(100, 100, 100, 25), " Client Logged");
if (GUI.Button(new Rect(100, 150, 100, 25), "Log Out"))
{
Network.Disconnect();
}
if (GUI.Button(new Rect(100, 190, 100, 25), "Thrown Card Name"))
{
GetComponent<NetworkView>().RPC("ClientThrownCardName", RPCMode.Server);
}
}
if (Network.peerType == NetworkPeerType.Server)
{
GUI.Label(new Rect(100, 100, 100, 25), " Server Started");
GUI.Label(new Rect(100, 125, 100, 25), "" + Network.connections.Length);
if (GUI.Button(new Rect(100, 150, 100, 25), "Log Out"))
{
Network.Disconnect();
}
}
}
}
[RPC]
public void ClientThrownCardName()
{
if (Network.isServer)
{
run();
}
}
[RPC]
public void run()
{
var throwzone = GameObject.Find("ThrowZone");
Debug.Log(throwzone.transform.GetChild(0).transform.name);
}