Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

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

NetworkClient.Configure(Tuner,int)

Switch to Manual

Parameters

tuner Use this tuner with the client instance.
maxConnections Maximum allowed simultaneous connections for given tuner.

Returns

void True if the tuner was configured successfully.

Description

Configure the client instance with the given tuner and connection count.

If you don't configure the client before connecting the default tuner (called "defaultClient") and connection count of one, will be used.

If you use the same tuner for other client instances the connection count must reflect that.

#pragma strict
public class Example extends MonoBehaviour {
	function DoConnect() {
		var tuner: Tuner = new Tuner("mytuner");
		tuner.AddChannel(UNETQosType.ReliableSequenced);
		tuner.AddChannel(UNETQosType.UnreliableSequenced);
		tuner.maxPacketSize = 500;
		NetworkClient.Instance.Configure(tuner, 1);
		NetworkClient.Instance.Connect("127.0.0.1", 7070);
	}
}