Version: 2017.2
public static NetworkConnectionError Connect (string IP, int remotePort, string password= "");

説明

指定したホスト( IP アドレスやドメイン名)のサーバーポートに接続します

The parameters are the IP address of the host. Either a dotted IP address or a domain name. remotePort, which specifies the port on the remote machine to connect to. password, which is an optional password for the server. The password has to match the Network.incomingPassword set on the server.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void ConnectToServer() { Network.Connect("127.0.0.1", 25000); } }

public static NetworkConnectionError Connect (string[] IPs, int remotePort, string password= "");

説明

この関数は Network.Connect とまったく同様ですが、IP アドレスの配列を許容します

It can be used when the host information from a master server returns multiple internal IP addresses, then the IP data structure can be passed directly into this connect function. It actually connects to the first IP which responds to a ping (i.e. is connectable).


public static NetworkConnectionError Connect (string GUID, string password= "");

説明

サーバー GUID に接続します。 NAT パンチスルーを行う唯一の方法です。

ホストの GUID の値は NetworkPlayer 構造によってローカルで公開されます。マスターサーバーも HostData 構造内でこれを提供します。


public static NetworkConnectionError Connect (HostData hostData, string password= "");

説明

マスターサーバーの返す HostData 構造で表されるホストに接続します。