Legacy Documentation: Version 2018.2 (Go to current version)
LanguageEnglish
  • C#

ConnectionConfig.MaxCombinedReliableMessageSize

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public ushort MaxCombinedReliableMessageSize;

Description

Defines the maximum size in bytes of a reliable message which is considered small enough to include in a combined message. Default value = 100.

Since each message sent to a server contains IP information and a UDP header, duplicating this information for every message sent can be inefficient in the case where there are many small messages being sent frequently. Many small reliable messages can be combined into one longer reliable message, saving space in the waiting buffer. Unity Multiplayer will automatically combine up to MaxCombinedReliableMessageCount small messages into one message. To qualify as a small message, the data payload of the message should not be greater than MaxCombinedReliableMessageSize.

using UnityEngine;
using UnityEngine.Networking;

public class ExampleScript : NetworkBehaviour { void Start() { ConnectionConfig myConfig = new ConnectionConfig(); myConfig.AddChannel(QosType.Unreliable); myConfig.AddChannel(QosType.UnreliableFragmented); myConfig.MaxCombinedReliableMessageCount = 20; //up to 20 messages myConfig.MaxCombinedReliableMessageSize = 500; //up to 500 bytes each } }

Did you find this page useful? Please give it a rating: