Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Making a remote procedure call return a value from the serve

Discussion in 'Multiplayer' started by Zante, Jun 26, 2010.

  1. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    429
    As far as I know, a RPC cannot be made to return a value due to the complexities involved with network lag.

    To that end, we have to use 2 RPCs,

    one from the client to initiate a server request
    one from the server to initiate a client response

    How do we make sure the RPC goes back to the appropriate client? - there is no RPCMode.Client (nor could such a command exist).

    How would you make sure the message gets back to where the initial RPC originated from?

    One way I can think of is by adding a networkplayer parameter to the original RPC but then the response from the server would go to all clients with only one knowing to actually respond to the RPC.


    Sincerely confused, would appreciate any help.

    Kind regards
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    there is such a mode: instead of rpcmode you just specify the networkplayer you want to send to

    see 2nd half of the .RPC docs :)
     
  3. Eagle32

    Eagle32

    Joined:
    Jun 20, 2010
    Posts:
    89