Hello everyone, please excuse my noob question as I’m learning Unity and I’ve got to the point of Network. As I was reading over M2H’s Networking tutorial (Zero to Hero) the part about RPC is very interesting. The way I understand it all the players network traffic communicate using the ‘networkView’ as a sort of tunnel to each other; like being linked together.
I figured like everything else I could call a RPC method defined in the Server from the Client. However, the only way I’ve been able to get the communication to work properly is to include the RPC method in the client code as well, even if RPCMode is set to ‘Server’. this is much no good. I’m wanting to have a ‘Server’ processes running on, lets say ‘Server Machine 1’ and have multiple clients connect to it, server is authorative and (the most important part) the clients have 0 access to the code being executed server side.
Info:
Two separate projects: Client and Server
Components of Main Camera of both:
networkView (off,mainCamera)
script (either server OR client)
Client (attempting to call method on the server):
networkView.RPC("Poke", RPCMode.Server);
Server
var PokeVar : boolean = false;
...
@RPC
function Poke(){
PokeVar = true;
}
Am I doing something wrong here or do I not understand RPC? Does the method -have- to be defined in the client?
Much thanks for the help, I’m face-desking here.
Pheagey
P.S.: when I -do- define it on both sides it does work. But again, I do not wish the clients to ever in any way, have access to the server side code.