Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [BossRoom] Why using Messaging instead of RPC ?

Discussion in 'Multiplayer' started by Ziboo, May 11, 2021.

  1. Ziboo


    Aug 30, 2011
  2. General rule of thumb (which sometimes gets ignored then, but in general): if you are initiating a command, then use RPC (you expect some action in return).
    If you send notification and stuff, you're messaging (You don't really expect any action in result)
    Ziboo likes this.
  3. fernando-a-cortez


    Unity Technologies

    Dec 14, 2020
    Hi Ziboo,

    Custom Messages are not bound to any object. RPCs at the moment are bound to a NetworkObject. This means that you must first establish a successful connection with a client before you wish to send RPCs to and from a client. Read more about MLAPI's messaging system here:

    You'll notice here:, that we want to inform the client of the result of the connection approval. In the case where the connect status is a failure, the only way we are able to communicate with a pending client is through Custom Messages because we don’t have NetworkObjects yet to use RPCs on.

    You can consider our usage of Custom Messages as a workaround to this limitation. In the future, we may refactor the connection approval message callback to allow the sending of more contextual connection information.

    Hope this clears that up for you.
    dasouth, Ziboo and CreativeChris like this.