Does UNET SendToClient send seperate packets or to what degree does it buffer the messages?

Does UNET SendToClient buffer messages (versus sending out separate packets)? For example if I want to transfer a list of Objects over the network:

//pseudo-ish code
foreach(CustomObject obj in Objects)
{
      CustomMessage msg = new CustomMessage(obj.val1,obj.val2,obj.val3);
      NetworkServer.SendToClient(recipient,msg);

}
  1. To what extend are the messages buffered or send separate? What if Objects is a large list?
  2. Would you recommend a better way of transferring complex object list over the network with UNET?

yes, the system will automatically buffer sends within a frame up to the MTU size (about 1400 bytes).

Look at the new network panels in the unity profiler to see details.

Thanks for the info, didn’t know about the new network profiling, defiantly checking it out. Would you say it’s good/ok practice to transfer object lists over network like this?

Your method is fine. If you tried to use one large message you would run into message size limits and have to switch to a fragmented channel. Probably better to just let the system aggregate multiple messages into reasonable packets for you.

You can also use arrays of structs in messages.