- Home /
RPC Call doesnt get called
Alright, the problem is that this part of script is failing to call "Client_PlayerAlive" from PlayerManager script. And it gives us a error: " RPC call failed because the function 'Client_PlayerAlive' does not exist in any script attached to 'MultiplayerManager' " Now the funny thing is that, MultiplayerManager does have this PlayerManager script so it should find Client_SpawnPlayer function from it.
[RPC]
void Client_SpawnPlayer(NetworkPlayer player, Vector3 position, Quaternion rotation)
{
MultiplayerManager.GetMPPlayer(player).PlayerIsAlive = true;
MultiplayerManager.GetMPPlayer(player).PlayerHealth = 100;
if(player == MyPlayer.PlayerNetwork)
{
MyPlayer.PlayerManager.ControllerTransform.position = position;
MyPlayer.PlayerManager.ControllerTransform.rotation = rotation;
MyPlayer.PlayerManager.networkView.RPC("Client_PlayerAlive", RPCMode.All);
}
else
{
}
}
And this is the function it's trying to load from PlayerManager.
[RPC]
public void Client_PlayerAlive()
{
if(networkView.isMine)
ControllerTransform.gameObject.SetActive(true);
else
OutsideView.SetActive(true);
}
Any ideas?
Answer by Fattie · Dec 09, 2014 at 02:10 PM
Explained here ...
That's the fifth time you've pasted that broken link in the last two $$anonymous$$utes...
Answer by Dave-Carlile · Dec 31, 2012 at 02:28 PM
Is PlayerManager the same class on both client and server? I ask because I use different objects, but the RPC method has to exist on both objects, even though the server side doesn't ever handle some of the calls I make. Don't know if this applies to you, but wanted to throw it out there just in case.
Basically, it seems that all the objects on all clients, and the server, that share a networkView must all implement the RPC method.
Right, basically if Unity throws this error you can be sure that somewhere on one "version" of this object the function is missing.
I didnt really understood what you guys were trying to tell? I'm newbie to networking. Would it help if I post full scripts / Pics how they're configured in Unity?
Your answer
Follow this Question
Related Questions
When connected to a server, can other players access my static variables and/or public variables? 2 Answers
How to use an RPC to send an animation over the network? 2 Answers
RPC custom server best practice 1 Answer
Multiplayer - Selected character to Network.guid? 0 Answers
Unity networking tutorial? 6 Answers