I’m in the process of learning networking and RPC’s. I had a basic RPC working earlier but it has stopped working and I’m unsure why.
I have 2 main networking scripts “server_core.cs” and “client_core.cs”.
The RPC is meant to send the server name to the client.
Within the “server_core.cs” script I have this.
public string serverName = "Test Server 01";
void OnPlayerConnected(NetworkPlayer netPlayer){
networkView.RPC("GetServerName", netPlayer, serverName);
}
Then in the “client_core.cs” I have this.
public string conServerName;
[RPC]
void GetServerName(string serverName){
conServerName = serverName;
}
My client is connecting to the server, yet when I use the variable “conServerName” it is an empty string.
Any help on this?
Thanks
- Matt