Version: 2017.4
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ConnectionConfig.PacketSize

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 var PacketSize: ushort;
public ushort PacketSize;

Description

Defines maximum packet size (in bytes) (including payload and all header). Packet can contain multiple messages inside. Default value = 1500.

Note that this default value is suitable for local testing only. Usually you should change this value; a recommended setting for PC or mobile is 1470. For games consoles this value should probably be less than ~1100. Wrong size definition can cause packet dropping.

no example available in JavaScript
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; } }