Version: 2017.2
public static void RegisterHost (string gameTypeName, string gameName, string comment= "");

描述

在主服务器上注册此服务器。

如果主服务器地址信息未更改,则使用默认 Unity 主服务器。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnGUI() { if (GUILayout.Button("Start Server")) { bool useNat = !Network.HavePublicAddress(); Network.InitializeServer(32, 25002, useNat); MasterServer.RegisterHost("MyUniqueGameType", "JohnDoes game", "l33t game for all"); } } }