Simple example of an RPC message?

Hey, I am at the point where I need to think about what the user sees when he/she is connected to a server.

If I could get some info on maybe how to just get it to spit out “john” connected.
then I could figure the rest out, the doc’s are a tad hard to understand for a beginner.
(John is a saved PlayerPref)
(This Doc)

Cheers,Tim.

I know it’s @RPC…something something heheh

So first you need your client to tell the server who he is :

function OnConnectedToServer ()
{
	var name:String = PlayerPrefs.GetString("Player Name");
	networkView.RPC("TellNameToServer", RPCMode.Server, name, Network.player);
}

Then you need your server to handle the info (stock it locally if you want for example in a list of players) and tell every client who just connected :

@RPC
function TellNameToServer(name:String, thisPlayer:NetworkPlayer) {
    networkView.RPC("DisplayName", RPCMode.AllBuffered, name);
}

And after that you need every player to handle this info (like stock it too, or display it in your case) :

@RPC
function DisplayName(name:String) {
    // Here you display the name, I don't know how you plan to do that, so you're on your own :)
}

All these functions are in the same script, every player must have it.