Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Network

class in UnityEngine

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

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

OnConnectedToServerCalled on the client when you have successfully connected to a server.
OnDisconnectedFromServerCalled on client during disconnection from server, but also on the server when the connection has disconnected.
OnFailedToConnectCalled on the client when a connection attempt fails for some reason.
OnNetworkInstantiateCalled on objects which have been network instantiated with Network.Instantiate.
OnPlayerConnectedCalled on the server whenever a new player has successfully connected.
OnPlayerDisconnectedCalled on the server whenever a player is disconnected from the server.
OnSerializeNetworkViewUsed to customize synchronization of variables in a script watched by a network view.
OnServerInitializedCalled on the server whenever a Network.InitializeServer was invoked and has completed.