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.isServer 是否服务器
static var isServer : bool
Description描述
Returns true if your peer type is server.
如果端点类型是服务器,返回true。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnGUI() {
if (Network.isServer)
GUILayout.Label("Running as a server");
else
if (Network.isClient)
GUILayout.Label("Running as a client");
}
}
function OnGUI() {
if (Network.isServer)
GUILayout.Label("Running as a server");
else if (Network.isClient)
GUILayout.Label("Running as a client");
}
最后修改:2011年4月2日 Saturday 12:46