Unity5.1 新的網路引擎UNET(十五) Networking 引用--下,unity5.1unet
孫廣東 2015.7.21
本節提供了與網路系統一起使用的組件的詳細資料。
10、Network Proximity CheckerSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkProximityChecker 是一個組件,它可以用來控制 網路用戶端,基於網路玩家 接近的對比的對象。若要使用它,請將該組件放在一定範圍內可見的對象上。此類依賴於物理計算的可見度。
Properties
| Property: |
Function: |
| visRange |
The range that the object should be visible in. |
| visUpdateInterval |
how often in seconds the object should check for players entering it’s visible range. |
| checkMethod |
Which type of physics to use for proximity checking. |
Network Manager HUDNetworkReader
11、NetworkReaderSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkReader 是一個用於從位元組流中讀取對象的 UNET 進階別 API 類。此類在與 NetworkWriter 一起工作。NetworkReader 具有許多Unity類型特定的序列化功能。
12、NetworkServerSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkServer 是一個 UNET 進階別 API 類,管理來自多個用戶端的串連。
Properties
| Property: |
Function: |
| connections |
The set of active connections to remote clients. |
| localConnections |
The set of active connections to local clients. |
| handlers |
The set of registered message handler function. |
| objects |
The set of spawned objects with NetworkIdentities. |
| active |
True if the server is listening and running (static). |
| localActiveClient |
True if there is a local client in the same process; this server is a “Host”. |
| numChannels |
The number of configured NetworkTransport QoS channels. |
13、NetworkStartPositionSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkStartPosition 被NetworkManager 使用,當建立player對象時。NetworkStartPosition的位置 和 旋轉 用來放新建立的Player 對象。
14、NetworkTransformSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkTransform 組件通過網路同步movemen運動的遊戲對象。此組件考慮權威,所以 LocalPlayer 對象 (其中有地方當局) 同步他們的 position 從用戶端到伺服器,然後出去給其他客戶機。其他對象 (與伺服器授權機構) 同步他們從伺服器到用戶端的位置。
若要使用此組件,請將其添加到您想要同步運動的預製或遊戲的對象。該組件要求遊戲對象具有 NetworkIdentity。請注意,必須催生網路的對象來同步。
Properties
| Property: |
Function: |
| transformSyncMode |
Which synchronization method to use for position. |
| sendInterval |
How often in seconds the object sends updates. |
| syncRotationAxis |
Which axis to use for rotation. |
| rotationSyncCompression |
What kind of compession to use for rotation. |
| syncSpin |
Flag to sync angular velocity. |
| movementTheshold |
The threshold to not send position updates. |
| snapThreshold |
The threshold to “pop” instead of interpolate. |
| interpolateRotation |
Factor to control rotation interpolation. |
| interpolateMovement |
Factor to control movement interpolation. |
Hints
• NetworkTransform的inspector有一個 NetworkSendRate 滑塊 。對於被建立後不需要更新 - 如子彈的對象,將此滑塊設定為零。
15、NetworkTransformVisualizerSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkTransformVisualizer 是一個公用程式utility 組件,允許可視化的內嵌使用 NetworkTransform 組件的對象。
Properties
| Property: |
Function: |
| VisualizerPrefab |
The prefab of an object to create to visualize the target position. |
16、NetworkTransportSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkTransport 是 UNET 低層級 API 介面。它是一個靜態類。
17、NetworkWriterSuggest a changeSuccess!
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseSumbission failed
For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseYour name Your email Suggestion *Submit suggestion
Cancel
NetworkWriter 是一個 UNET 進階別 API 類,用於將對象寫入位元組流。此類在與 NetworkReader 一起工作。NetworkWriter 具有許多統一類型特定的序列化功能。
NetworWriter 與 MessageBase 類用於使包含序列化的網路訊息的位元組數組。
void SendMessage(short msgType, MessageBase msg, int channelId){ // write the message to a local buffer NetworkWriter writer = new NetworkWriter(); writer.StartMessage(msgType); msg.Serialize(writer); writer.FinishMessage(); myClient.SendWriter(writer, channelId);}
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。