Search Unity

Can a client call a ClientRpc on every other client?

Discussion in 'Multiplayer' started by andysctu, Jun 8, 2016.

  1. andysctu

    andysctu

    Joined:
    Jun 14, 2014
    Posts:
    20
    I'd like for a client to call a ClientRpc on every other client (send everyone a message, etc).

    The way I am currently doing this is I am sending a Cmd to the Server with the message, then I have the server call a ClientRpc to relay that message to everyone.

    Is there a direct way to go from client -> clients, instead of client -> server -> clients?

    Thanks
     
  2. Oshroth

    Oshroth

    Joined:
    Apr 28, 2014
    Posts:
    99
    Clients, by default, don't know about the other clients. Only the server keeps track of the client connections.
     
  3. Bmandk

    Bmandk

    Joined:
    Aug 18, 2012
    Posts:
    70
    Yes, this is true. On top of that, UNET doesn't allow you to call Rpc's from clients. Rpc's are a way to sync out a message from the server to all clients.

    What you can do, is call a Command that in turn calls an Rpc. This is essentially the same, just with the need to first get it to the server.