MasterServer.dedicatedServer 专用服务器

static var dedicatedServer : bool

Description描述

Report this machine as a dedicated server.

声明本机为专用服务器。

If running as a server the connection count defines the player count and this is reported when registering on the master server. By default the master server assumes this instance is not a dedicated server and thus the player count is incremented by one (to account for the \"client\" running on the server). If this is not desired this variable can be set to false and then only the connection count is reported in the host data as the player count.

如果做为服务器运行,连接数定义为玩家数,当在主服务器上注册时它会被告知。在默认情况下,主服务器假定它不是一个专用服务器,那么玩家数增加一个(加上可以运行在服务器上的那个客户端)。如果不需要,这个变量可以被设置为false,那么在主机数据中连接数被告知为玩家数。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void StartServer() {
		Network.InitializeServer(32, 25002);
		MasterServer.dedicatedServer = true;
		MasterServer.RegisterHost("MyUniqueGameType", "JohnDoes game", "l33t game for all");
	}
}
function StartServer() {
	Network.InitializeServer(32, 25002);
	// Not running a client locally 
	//本地不运行客户端。
	MasterServer.dedicatedServer = true;
	MasterServer.RegisterHost("MyUniqueGameType",	"JohnDoes game", "l33t game for all");
}
Page last updated: 2011-1-4