UPDATE! I got the answer! (found it last night) but I cant answer my own question, I think it’s because this question is pending moderator approval… can someone approve my question so I can answer it myself? Thanks!
Hi there and thanks for checking out my question!
I have 2 unity projects (1 client and 1 server) who connect with eachother via Unity Networking.
In the client app there are 2 functions with RPC: AddLayer and RunCommand. Both are defined like this:
[RPC]
void AddLayer(string image) {
Debug.Log (image);
}
[RPC]
void RunCommand(string command) {
Debug.Log (command);
}
At first I only had RunCommand. I had to send a byte and read that it was possible so I made AddLayer which used to accept a byte. After I started calling AddLayer via RPC on the server app (to the client app) it didnt work.
So I tried making a string of image instead of byte see if that worked (just like RunCommand)
Unfortunately it still didnt work! This is the error I got both with byte and string
RPC call failed because the function 'AddLayer' does not exist in the any script attached to'Main Camera'
-
This error appears on the server and not in the client’s console!
-
The function AddLayer IS present (the error must be wrong)
-
Another thing to note is that RunCommand just works fine without any issues, before and after AddLayer was added.
I call AddLayer like this (on the server):
public void SendImageLayer(NetworkPlayer client, byte[] img) {
networkView.RPC ("AddLayer", client, "test");
}
Please ignore the fact that SendImageLayer accepts a byte, as I said earlier I changed it to a string to see if byte was the problem.
The bottom line is that it seems that only the first RPC method works.
I’m a little bit out of ideas here, if anyone knows the answer to this little mystery I would be so happy!
I run Unity 5.0.2f1 on Mac OS X
Thanks!