- Home /
supplied parameters doesn't match the rpc declaration
Im trying to send functions using RPC...but it always said this message when i press the W keybutton!!
Sending RPC 'OUD' failed because the number of supplied parameters doesn't match the rpc declaration. Expected 0 but got 1 parameters.
UnityEngine.NetworkView:RPC(String, RPCMode, Object[])
thats my script and i dont know whats wrong with it
function Update()
{
if(Input.GetKeyDown(KeyCode.W)){networkView.RPC("ODW",RPCMode.Others,null);}
if(Input.GetKeyUp(KeyCode.W)){networkView.RPC("OUW",RPCMode.Others,null);}
}
@RPC
function ODW(){test=true;}
@RPC
function OUW(){test=true;}
Answer by DudeGuy · Nov 14, 2014 at 08:32 PM
I'm guessing it thinks your methods ODW and OUW take a parameter because you're sending null as the third parameter instead of an empty array.
Try making this call instead:
networkView.RPC( "ODW", RPCMode.Others, new object[] {} );
Forgive me if my syntax is off. Java is not a language I use :)
THX YOU SO $$anonymous$$UCH....but it actually make an error if you dont use a Var between the ''( )''
but its fine i just remove the hole thing and keep it up like this
networkView.RPC("OUW",RPC$$anonymous$$ode.Others);
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
RPC setName() not working correctly 0 Answers
Unity networking,Cant see each other move 2 Answers
GetComponent().enabled = true; 1 Answer
Static variables 1 Answer