Hope to have a great god give me have a look at a simple, send messages and advice in respect of the client receives the message or code, thank you
Far as I understand from your question, you’ll need to create your message class based on MessageBase, and you need to give it an ID (short number, to be safe make it higher than 50), then from the server you need to get the NetworkConnection object of the client you want to send the message to, and a simple connection.Send(message_id, message) will send the message to the client.
From the client you’ll need to register a handler, it was something like client.RegisterHandler(message_id, handler_method) the handler_method is a void return and takes 1 NetworkMessage argument, it’ll be invoked with the received message whenever a message with that ID is received on client.
You can find a small usage of messages in here: Login system for online multiplayer game - Unity Engine - Unity Discussions it was used for login system, but you can see server-client code in there and how messages are built.
Thanks,I go to learn。