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.OnConnectedToServer 当连接到服务器
function OnConnectedToServer () : void
Description描述
Called on the client when you have successfully connected to a server
当成功连接到服务器时,在客户端调用这个函数。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnConnectedToServer() {
Debug.Log("Connected to server");
}
}
function OnConnectedToServer() {
Debug.Log("Connected to server");
// Send local player name to server ...
//发送本地玩家名到服务器
}
最后修改:2011年4月1日 Friday 20:45