サーバーを初期化します
connections は、許可された接続の数です。(これは通常、プレイヤー数とは異なるものですのでご注意ください。)
listenPort は、リッスンするポート番号です。
useNat は NAT パンチスルー機能を設定します。このサーバーが NAT パンチスルーを使用して接続を受け入れられるようにするには、
ファシリテーターを使用して、これを true に設定してください。
function LaunchServer () {
Network.incomingPassword = "HolyMoly";
var useNat = !Network.HavePublicAddress();
Network.InitializeServer(32, 25000, useNat);
}
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void LaunchServer() { Network.incomingPassword = "HolyMoly"; bool useNat = !Network.HavePublicAddress(); Network.InitializeServer(32, 25000, useNat); } }