RPC Calls Not Working

In simple, Unity just doesn’t want to call my RPC functions.

My project is set up where a different scene and different script does the networking. For clients, the script is called “ConnectionScript”, for server the script is called “ServerScript”. They are both on the same viewID and both have a networkView attached to them with reliable compressed.

The code when I call (From ConnectionScript) is this:

networkView.RPC("test", RPCMode.Server);

The RPC code is (ServerScript):

[RPC]
public void test()
{
	Debug.Log("Test");	
}

All connections work fine and I can easily connect to the server, but once I try and send an RPC, nothing appears to happen. I have the project settings set to run in the background, too.

Could somebody point me in the right direction?

Thanks!

Both sides need the RPC function “test”. They can be different functions, but both sides need to have the function since it is possible to call it on your own client.

Usually you should get an error message that the RPC function wasn’t found. Have you checked the error log?