Version: 2017.3

Network

class in UnityEngine

Cambiar al Manual

Descripción

The network class is at the heart of the network implementation and provides the core functions.

This class configures the network interface and all the network parameters. You use it to set up a server or connect to one and have a row of helper functions to help you with those tasks. For more information on what is exposed in the editor see the Network Manger component reference.

Variables Estáticas

connectionsTodos los jugadores conectados.
connectionTesterIPThe IP address of the connection tester used in Network.TestConnection.
connectionTesterPortThe port of the connection tester used in Network.TestConnection.
incomingPasswordSet the password for the server (for incoming connections).
isClientReturns true if your peer type is client.
isMessageQueueRunningEnable or disable the processing of network messages.
isServerReturns true if your peer type is server.
logLevelSet the log level for network messages (default is Off).
maxConnectionsSet the maximum amount of connections/players allowed.
minimumAllocatableViewIDsGet or set the minimum number of ViewID numbers in the ViewID pool given to clients by the server.
natFacilitatorIPThe IP address of the NAT punchthrough facilitator.
natFacilitatorPortThe port of the NAT punchthrough facilitator.
peerTypeThe status of the peer type, i.e. if it is disconnected, connecting, server or client.
playerGet the local NetworkPlayer instance.
proxyIPLa dirección IP del servidor proxy.
proxyPasswordDefinir la contraseña del servidor proxy.
proxyPortEl puerto del servidor proxy.
sendRateThe default send rate of network updates for all Network Views.
timeGet the current network time (seconds).
useProxyIndicate if proxy support is needed, in which case traffic is relayed through the proxy server.

Funciones Estáticas

AllocateViewIDQuery for the next available network view ID number and allocate it (reserve).
CloseConnectionCierra la conexión con otro sistema.
ConnectConnect to the specified host (ip or domain name) and server port.
DestroyDestroy the object associated with this view ID across the network.
DestroyPlayerObjectsDestroy all the objects based on view IDs belonging to this player.
DisconnectCierra todas las conexiones y apaga la interfaz de red.
GetAveragePingThe last average ping time to the given player in milliseconds.
GetLastPingThe last ping time to the given player in milliseconds.
HavePublicAddressCheck if this machine has a public IP address.
InitializeSecurityInitializes security layer.
InitializeServerInicializar el servidor.
InstantiateNetwork instantiate a prefab.
RemoveRPCsRemove all RPC functions which belong to this player ID.
RemoveRPCsInGroupRemove all RPC functions which belong to given group number.
SetLevelPrefixSet the level prefix which will then be prefixed to all network ViewID numbers.
SetReceivingEnabledEnable or disables the reception of messages in a specific group number from a specific player.
SetSendingEnabledEnables or disables transmission of messages and RPC calls on a specific network group number.
TestConnectionComprobar la conexión de red de esta máquina.
TestConnectionNATTest the connection specifically for NAT punch-through connectivity.

Mensajes

OnConnectedToServerLlamado en el cliente cuando usted se ha conectado con éxito a un servidor.
OnDisconnectedFromServerCalled on client during disconnection from server, but also on the server when the connection has disconnected.
OnFailedToConnectLlamado en el cliente cuando un intento de conexión falla por alguna razón.
OnNetworkInstantiateLlamado en objetos que han sido instaciados en la red con Network.Instantiate.
OnPlayerConnectedLlamado en el servidor cuando un nuevo player se ha conectado con éxito.
OnPlayerDisconnectedCalled on the server whenever a player is disconnected from the server.
OnSerializeNetworkViewUtilizado para personalizar la sincronización de variables en un script observado por un network view.
OnServerInitializedLlamado en el servidor cada vez que un Network.InitializeServer fue invocado y se ha completado.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961