Version: 2017.2
public ushort FragmentSize ;

Descripción

Defines the fragment size for fragmented messages (for QOS: ReliableFragmented and UnreliableFragmented). Default value = 500.

Under fragmented quality of service modes, the original message is split into fragments (up to 64) of up to FragmentSize bytes each. The fragment size depends on the frequency and size of reliable messages sent. Each reliable message potentially could be re-sent, so you need to choose a fragment size less than the remaining free space in a UDP packet after retransmitted reliable messages are added to the packet. For example, if ConnectionConfig.PacketSize is 1440 bytes, and a reliable message's average size is 200 bytes, it would be wise to set this parameter to 900 – 1000 bytes.

using UnityEngine;
using UnityEngine.Networking;

public class ExampleScript : NetworkBehaviour { void Start() { ConnectionConfig myConfig = new ConnectionConfig(); myConfig.AddChannel(QosType.Unreliable); myConfig.AddChannel(QosType.UnreliableFragmented); myConfig.PacketSize = 1440; myConfig.FragmentSize = 900; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961