Hi, I'm very confused here, just trying to understand the basics of how RPC calls work. But I'm having some errors, that in my point of view do not make any sense.
on my server i have an RPC function on a script attached to the main camera(only object on it):
[RPC]
void Register(string Username, string password)
{
PlayerPrefs.SetString(Username,Username);
PlayerPrefs.SetString(Username+"password", password);
}
on my client I have a GameObject made only for this inicial menu purpose, after i successfully connected to the server, i call the server RPC funtion:
GUILayout.Label("Username");
username = GUILayout.TextArea(username);
GUILayout.Label("Password");
password = GUILayout.TextArea(password);
if (GUILayout.Button("Register"))
{
if(Network.isClient)
{
networkView.RPC("Register",RPCMode.Server,username,password);
UI=1;
}
}
i get the error that the GameObject of the client does not have a function named "Register".... i do know that the client does not have this function, but why is this a problem?
RPC call failed because the function 'Register' does not exist in the any script attached to'GameObject'
UnityEngine.NetworkView:RPC(String, RPCMode, Object[])
StartClient:OnGUI() (at Assets/Client stuff/Scripts/StartClient.cs:148)
↧