Network.connections 连接列表

static var connections : NetworkPlayer[]

Description描述

All connected players.

所有连接的玩家。

On a client this contains only the server.

在客户端中,该变量只包含服务器。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnGUI() {
		if (GUILayout.Button("Disconnect first player"))
			if (Network.connections.Length > 0) {
				Debug.Log("Disconnecting: " + Network.connections[0].ipAddress + ":" + Network.connections[0].port);
				Network.CloseConnection(Network.connections[0], true);
		}

	}
}
function OnGUI() {
	if (GUILayout.Button ("Disconnect first player")) {
		if (Network.connections.Length > 0) {
			Debug.Log("Disconnecting: "+
				Network.connections[0].ipAddress+":"+Network.connections[0].port);
			Network.CloseConnection(Network.connections[0], true);
		}
	}
}
Page last updated: 2011-4-2