UNET Discrete Server/Client. ClientRPC? Command?

Hi all, I’m having a lot of trouble with UNET, trying to understand how to implement a discrete client/server setup.
With the old system I could create my client, and my server, connect, and use RPCs to do everything I wanted. Now… I have no idea, and it’s kinda frustrating because I want to do some really basic things.

I’ve read through the documentation, watched a few hours worth of tutorials, and downloaded sample projects, as well as trawled through these questions to see if anyone has my problem, and no luck so far.

From the documentation, server works fine
public void SetupServer()
isAtStartup = false;

Client connects
void ConnectToServer()
myClient = new NetworkClient();
myClient.RegisterHandler(MsgType.Connect, OnConnected);
myClient.Connect(“”, 4445);

How do I execute the equivalent of an RPC? Say, from the client, I want to send a simple string to the server? I’ll then want to send that string to clients.

I’ve read about [Command] and [ClientRPC] and [ClientCallback], but literally every example I’ve found uses a game that can act as host, client, or both. In the project I’m working on there is no need to run the game as a host, because it’s not that type of multiplayer.

Consider it asynchronous. A client will play, and at some point some updates will be sent to the server (a score, for example). And all that server will do is store that information, and at some point propagate it out to clients.

Can anyone give direction on the best way to achieve this kind of system? Can I use [Command] [ClientRPC]? How do I implement them when they aren’t sharing the same application codebase and thus don’t have the same methods/functions? (do they need to? RPCs had to be on both client and server, but you could leave the one which didn’t need to execute anything blank - is it like this?)

Any help appreciated

“and thus don’t have the same methods/functions”

it’s totally meaningless otherwise – of course, you have to have matching functions!!!

you may as well ask “how can two totally unrelated networks network?” !

note that you can, if you want, arrange to simply pass a string, which “means” a command in your system. you can then (if you want) ignore these “word commands” which you don’t know about yet, flag a version error, or whatever.

In the spirit of your very general questions about network topology for games,


and the long answer here Games with multiple maps - Questions & Answers - Unity Discussions

Hey there,
ClientRPC, Command and ClientCallback are all part of the High Level API. And when things are High Level, it also means it doesn’t necessarily cover your specific needs.

If there’s something you want to achieve that can’t be achieved with the High Level API, I suggest you take a look at the Low Level API (aka Transport Level API)


I think this is perhaps where you would want to look for answers.

Edit: Just stumbled across this example of a Master Server implementation (from the looks of it, that’s exactly what you’re trying to do http://forum.unity3d.com/threads/master-server-sample-project.331979/ )

Hi guys, it took some time but I solved the problem and basically the answer I’ve come up with is to use messages. I made a more detailed post about the solution here if anyone cares about the detail: