RPC's and RPCMode.Server....

Can the server send an RPC with RPCMode.Server and get it? Or do I have to have some local code if it is the server and the RPC if its the client?

For example…

if (Network.isServer) {
update score locally
}
else {
RPC call here using RPCMode.Server to send teh server a command to update teh player score
}

of could I not just have.

if (networkView.isMine)
RPC call to server to pdate player score whether its the server or not

Does this make sense?

The server can get it’s own messages. Similar to calling RPCMode.All.
How about just call the RPC function locally and then do a broadcast to RPCMode.Others?

Thanks Shaun. But then I would be using 2 sets of code again (local and other) that I am trying to do in 1 set of code.

I just want to say… whomever I am… to send my score update to the server. If I also happen to be the server it shouldn’t matter.

You can call the RPC as a local function too.

From the Newtork Example:

if (Event.current.type == EventType.keyDown  Event.current.character == "\n"  inputField.Length > 0)
	{
		ApplyGlobalChatText(inputField, 1); //We call the RPC locally for me
		networkView.RPC("ApplyGlobalChatText", RPCMode.Others, inputField, 0);// We tell the other members to call the RPC themselves
		inputField = ""; //and clear the chat msg window
	}

@RPC
function ApplyGlobalChatText (str : String, mine : int)
{
	//Add the message str to the Chat History array
}

Hope this helps.
Shaun

Ok, I get what you mean. Cool, Thanks :slight_smile: