Network
- AllocateViewID
- CloseConnection
- connections
- connectionTesterIP
- connectionTesterPort
- Connect
- DestroyPlayerObjects
- Destroy
- Disconnect
- GetAveragePing
- GetLastPing
- HavePublicAddress
- incomingPassword
- InitializeSecurity
- InitializeServer
- Instantiate
- isClient
- isMessageQueueRunning
- isServer
- logLevel
- maxConnections
- minimumAllocatableViewIDs
- natFacilitatorIP
- natFacilitatorPort
- OnConnectedToServer
- OnDisconnectedFromServer
- OnFailedToConnectToM...
- OnFailedToConnect
- OnNetworkInstantiate
- OnPlayerConnected
- OnPlayerDisconnected
- OnSerializeNetworkView
- OnServerInitialized
- peerType
- player
- proxyIP
- proxyPassword
- proxyPort
- RemoveRPCsInGroup
- RemoveRPCs
- sendRate
- SetLevelPrefix
- SetReceivingEnabled
- SetSendingEnabled
- TestConnectionNAT
- TestConnection
- time
- useProxy
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);
}
}
}
最后修改:2011年4月2日 Saturday 12:25