I’m having a bit of trouble with an RPC. Using the following code, I got an error message I haven’t seen before:
As far as I can tell, I’ve structured the call the same way the example in the docs for NetworkView.RPC() does. Can someone explain this error? Thanks.
NM, I had a brain fart and forgot I was converting an old tool in a new script, and forgot to remove the old function definition which took a string argument.
I am however, getting a new error:
The only other thread on this error I could find suggests it’s related to JS/C# interoperability, but there isn’t that problem here. I did as was suggested (remove the offending script from the project and re-insert it), but I still get the error. Is it possible it stems from the fact that this class extends another class (which itself extends MonoBehaviour)?
I think that’s definitely worth investigating. Maybe you could push the RPC up or pull it down and see if that works or - just for testing - remove the inheritance altogether (i.e. directly inherit and copy the inherited code that’s needed).
Not that I’m perfectly sure but it sounds like the best bet ATM because I think RPCs do some “magic” that might not be perfectly compatible with inheritance.
Or a restriction on the JS implementation as it isn’t focused on complex code systems, thats C#s field
would have to test though if it works on C# or not
Just thought I’d put a note here to say I had this problem, an RPC call giving “Expected 1 but got 2 parameters” even though the RPC looked good, and it turned out that I had a deactivated script with an RPC function of the same name attached to my object. Removing this script seems to have solved the problem.
Makes sense that it then fails as it no longer can generate a correct RPC function lookup table for the network view attached as a missing monobehaviour would make the internal reflection fail.
I would still prefer if unity would consider missing component an error and accordingly print to debug console and prevent it from running, can take hours to find the one fucked up object in more complex projects