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;}

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 :slight_smile: