Unity5.1 new network engine unet (15) Networking reference--__net

Source: Internet
Author: User
Tags documentation unity network

Sun Guangdong 2015.7.21

This section provides detailed information about the components that are used with the network system.


3, Networkclient

Networkclient is a HLAPI class that manages the network to connect to the server--corresponding to Unet networkserver. It can be used to send messages to the server and receive messages from the server. Networkclient can also help manage the routing of Derived network objects and RPC messages and network events. Properties

Property
: Function:
ServerIP The IP address of the server, this client is connected to.
ServerPort The port of the the server, this, the client is connected to.
Connection The Networkconnection object this client is using.
Handlers The set of registered message handler functions.
Numchannels The number of configured Networktransport QoS channels.
IsConnected True If the client is connected to a server.
Allclients List of active network clients (static).
Active True If any network clients are active (static).

4, Networkconnection

Networkconnection is a Hlapi class that encapsulates a network connection.   The Networkclient object has a networkconnections, and networkservers has multiple networkconnections------from each client. A network connection has been able to send a byte array, or a serialized object as a network message. Properties

Property
: Function:
HostId The Networktransport hostId for this connection.
ConnectionID The Networktransport ConnectionID for this connection.
IsReady Flag to the whether state updates are the sent to this client.
Address The IP address of the end-point so this connection is connected to.
Playercontrollers The set of players that have been added with Addplayer ().

5, Networkidentity

The Networkidentity component is the unity component, which is the core of the new network system. It can be added to the object. From the-addcomponents->network->networkidentity menu item. This component controls the network identity of the object. This indicates that the Networkidentity component is shown on an object as follows:


With Unity Network system's server authoritative systems, the networkidentities of the network objects must be "spawned" by the server using Networkserver.spawn (). This causes them to be assigned Networkinstanceid and created on the client connected to the server.


Scene objects are somewhat different than dynamic instantiation objects. These objects are all present in the scene on both the client and the server. However, when building games for all scene objects The identities will be disabled. When the client connects to the server, the server notifies the client which scene objects should be enabled and that their latest status information is passed through the spawn message. This ensures that the client will not contain the object placed in the current incorrect position when he starts playing, or even the object will be deleted immediately because some of the events in the previous client connection were removed. The Serveronly check box ensures that a particular object is not spawned or enabled on the client.


This component contains trace information like what scenario ID, network ID, and asset ID have been assigned to the object. The scene ID is a valid in all scene objects of the networkidentity component. The network ID is the ID of this particular object instance, and there may be an instantiation of the specific object type for multiple objects and an object for the identity used by the network ID, for example, the network update should apply. The asset ID refers to what source asset object is instantiated. This is used internally when a specific object preset is spawned by the network. This information is exposed to the inspector at the bottom of the preview panel:


Details to be displayed here at run time (disabled networkbehaviour display is not bold): Properties

Property
: Function:
NetID A Unique identifier for this network sessions, assigned when spawned.
Sceneid A unique identifier for networked objects in a scene. This is only populated in Play-mode.
Isclient True if this object is running on a client.
Isserver True if this object was running on the server, and has been spawned.
Hasauthority True If this object is the authoritative version of the object. So either on a the server, or in the client with localplayerauthority.
Localplayerauthority True if this object was controlled by the client so owns It-the local player object on that client has authority over I T. This are used by the other components such as networktransform.
Serveronly A flag to make this object is spawned on clients.
AssetID This identifies the prefab associated and this object (for spawning).
Playercontrollerid The identifier of the controller associated with this object. Only valid for player objects.
Observers The list of client networkconnections that are able to the. This is read-only.
hintsPut a networkidentity component on prefabs that would be spawned. A networkidentity is required for every object, is networked.
6. Network Lobby ManagerSuggest a change success!

Thank for helping us improve the quality of Unity documentation. Although we cannot accept all submissions, we did read each suggested the change from our users and would make updates where app Licable. Close Sumbission failed

For some reason your suggested the change could the not to 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. Close Your name Your Email suggestion * Submit suggestion

Cancel

Networklobbymanager is a special kind of network manager, which mainly plays the game into the main scene before the provision of a multi-storey lobby.

• Provide player restrictions on the internet lobby
• All players are ready at the start of the game
• Players cannot join game-in-progress
• Support for "couch multiplayer"
• Customizable options for player selection in the lobby

There are two types of players with Networklobbymanager objects:
Lobbyplayer objects
• For each player
• Create a client connection, or when the player is added
• Persist until the client disconnects
• Have ready flag and configuration data
• Handling orders in the Hall
• Networklobbyplayer components should be used

Gameplayer objects
• For each player
• Created when the game scene is started
• Be destroyed when entering the hall again
• Handle the command Properties in the game

property: Function:
Showlobbygui Show the Legacy Ongui controls for the lobby.
maxplayers The maximum number of players allowed in the lobby.
maxplayersperconnection The maximum number of players allowed to is added for each clie NT connection.
lobbyplayerprefab The prefab to create for players when they enter the lobby.
gameplayerprefab The prefab to create for players when the game starts.
lobbyscene "scene to" for the lobby.
playscene "scene to" for main game.
Details  Lobbyplayerprefab slots should be filled in with an object's Networklobbyplayer component. There is a lobby manager GUI. See Multiplayer Game Hall Asset Pack.


7. Network Lobby Player Suggest a change success!

Thank for helping us improve the quality of Unity documentation. Although we cannot accept all submissions, we did read each suggested the change from our users and would make updates where app Licable. Close Sumbission failed

For some reason your suggested the change could the not to 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. Close Your name Your Email suggestion * Submit suggestion

Cancel

Networklobbyplayer is the state of each player Networklobbymanager used to store in the lobby. Properties

Property
: Function:
Showlobbygui True to show the legacy user interface for players in the lobby.
Slot The slot this player is allocated too. Only one player can is in each lobby slot.
Readytobegin Flag to control if the player is ready for the game to start.

8. Network Manager unet Suggest a change success!

Thank for helping us improve the quality of Unity documentation. Although we cannot accept all submissions, we did read each suggested the change from our users and would make updates where app Licable. Close Sumbission failed

For some reason your suggested the change could the not to 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. Close Your name Your Email suggestion * Submit suggestion

Cancel


The network manager is a higher level class that allows you to control the state of a network game. It provides an interface editor for, and scenarios, to be used in the configuration of preset control networks for different network game states. Properties

Property
: Function:
Networkport The network port used to listen in and connect to.
NetworkAddress The network address to connect to.
Dontdestroyonload Flag to make the networkmanager persist between scenes.
Runinbackground Flag to make the player run in the background by default.
Sendpeerinfo Flag to have network information on all peers sent to all participating.
Maxdelay The maximum time in seconds to delay buffered messages.
LogLevel The level of network logging to write.
Playerprefab The prefab to instantiate for players when a client connects.
Autocreateplayer Flag to automatically add a player when a client connects.
Playerspawnmethod How to spawn players at Startpositions.
Offlinescene The scene to switch to the network goes off-line.
Onlinescene The scene to switch to the network goes on-line.
Spawnprefabs The set of registered Spawnable prefabs.
Startpositions The set of Networkstartposition objects found in the scene.
Customconfig Flag to use custom network configuration (Advanced).
Connectionconfig Advanced Custom Network configuration data.
MaxConnections The maximum number of connections allowed by the server.
Channels The number of transport layer QoS channels.
Securetunnelendpoint End point for the XBox Live connectivity.
Usesimulator Flag to use network conditions simulation.
Simulatedlatency Latency in milliseconds to add when network Simulator active.
Packetlosspercentage The percentage of packet loss to add when network Simulator active
Matchhost Matchmaker host address.
Matchport Matchmaker host port.

9. Network Manager HUD suggest a change success!

Thank for helping us improve the quality of Unity documentation. Although we cannot accept all submissions, we did read each suggested the change from our users and would make updates where app Licable. Close Sumbission failed

For some reason your suggested the change could the not to 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. Close Your name Your Email suggestion * Submit suggestion

Cancel
Controlling the network state of the game provides the default user interface. It also displays information about the current state of the network manager in the editor. Properties

Property
: Function:
Showgui Flag to show the default UI.
OffsetX The horizontal pixel offset of the UI.
OffsetY The vertical pixel offset of the UI.
The Details

Networkmanagerhud allows you to view the objects in the editor, such as connections, which lists many details of a known network, and activates the player object.








(

)--[* *]-------()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.