Custom Messages
If you do not want to use the Netcode for GameObjects (Netcode) messaging system, you do not have to. You can use a thin layer called "Custom Messages" to implement your own behaviour and add custom targeting. They are unbound to any game object. Custom messages can be used in combination with RPC messages.
Custom messages comes in two forms: named and unnamed.
To send messages from client to client, server to client, and client to server through the provided clientId
. For example, from client to server provide NetworkManager.Singleton.ServerClientId
as the clientId
.
#
Unnamed MessagesUnnamed messages can be thought of as a single sending channel. A message sent has one receive handler, this is useful for building your own custom messaging system.
Usage
#
Named MessagesIf you want a completed messaging system, you can use named messages. The receiver registers one listen handler for each message type, and the sender can choose what type to send.
Usage