HostData.connectedPlayers 连接的玩家数

var connectedPlayers : int

Description描述

Currently connected players

当前连接的玩家数。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		HostData[] hostData = MasterServer.PollHostList();
		foreach (HostData element in hostData) {
			Debug.Log(element.connectedPlayers + " are connected to " + element.gameName);
		}
	}
}
// Requests info from the master server and prints
// the number of players playing on each host
//从master服务器请求信息,并打印每个主机的当前玩家数

function Start() {
	var hostData : HostData[] = MasterServer.PollHostList();
	for(var element : HostData in hostData) {
		Debug.Log(element.connectedPlayers + " are connected to " + element.gameName);
	}
}
最后修改:2011年2月24日 Thursday 12:05

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。