is there easy way to let RPC's return a value? I think it's a very common usecase to use a RPC to obtain data from another machine, and without a return value thats much more difficult.
One solution could be of a custom 2-way communication where one first calls the RPC and then the target invokes "back" another defined RPC on the caller to return the result. Isn't that a bit oversized?
Anybody some ideas?
asked Mar 06 '10 at 11:12 AM
The reason there is no return value is that the function would have to wait for a response from another machine to continue execution, at least in your example there, which can take quite a while. This becomes a problem when you are running a single threaded program (Unity only uses one thread) and execution is stalled for what is an unknown time.
Your suggestion for a two way system there is right however. Call an RPC function from the server directed at a client. When the client receives the RPC, the client sends another RPC call back to the server with the relevant information the server requested. This can be done the opposite way as well.
answered Mar 06 '10 at 11:55 PM