A component that manages the process of a new host taking over a game when the old host is lost. This is referred to as "host migration". The migration manager sends information about each peer in the game to all the clients, and when the host is lost because of a crash or network outage, the clients are able to choose a new host, and continue the game.
The old host is able to rejoin the new game on the new host.
The state of SyncVars and SyncLists on all objects with NetworkIdentities in the scene is maintained during a host migration. This also applies to custom serialized data for objects.
All of the player objects in the game are disabled when the host is lost. Then, when the other clients rejoin the new game on the new host, the corresponding players for those clients are re-enabled on the host, and respawned on the other clients. No player state data is lost during a host migration.
This class provides a simple default UI for controlling the behaviour when the host is lost. The UI can be disabled with the showGUI property. There are a number of virtual functions that can be implemented to customize the behaviour of host migration.
Note that only data that is available to clients will be preserved during a host migration. If there is data that is only on the server, then it will not be available to the client that becomes the new host. This means data on the host that is not in SyncVars or SyncLists will not be available after a host migration.
The callback function OnStartServer is invoked for all networked objects when the client becomes a new host.
On the new host, the NetworkMigrationManager uses the function NetworkServer.BecomeNewHost() to construct a networked server scene from the state in the current ClientScene.
The peers in a game with host migration enabled are identified by their connectionId on the server. When a client reconnects to the new host of a game, this connectionId is passed to the new host so that it can match this client with the client that was connected to the old host. This Id is set on the ClientScene as the "reconnectId".
The old host of the game, the one that crashed or lost its network connection, can also reconnect to the new game as a client. This client uses the special ReconnectId of ClientScene.ReconnectIdHost (which is zero).
client | The client instance that is being used to connect to the host. |
disconnectedFromHost | True is this is a client that has been disconnected from a host. |
hostMigration | Controls whether host migration is active. |
hostWasShutdown | True if this was the host and the host has been shut down. |
matchInfo | Information about the match. This may be null if there is no match. |
newHostAddress | The IP address of the new host to connect to. |
offsetX | The X offset in pixels of the migration manager default GUI. |
offsetY | The Y offset in pixels of the migration manager default GUI. |
oldServerConnectionId | The connectionId that this client was assign on the old host. |
peers | The set of peers involved in the game. This includes the host and this client. |
pendingPlayers | The player objects that have been disabled, and are waiting for their corresponding clients to reconnect. |
showGUI | Flag to toggle display of the default UI. |
waitingReconnectToNewHost | True if this is a client that was disconnected from the host and is now waiting to reconnect to the new host. |
waitingToBecomeNewHost | True if this is a client that was disconnected from the host, and was chosen as the new host. |
BecomeNewHost | This causes a client that has been disconnected from the host to become the new host of the game. |
DisablePlayerObjects | This causes objects for known players to be disabled. |
FindNewHost | This is a utility function to pick one of the peers in the game as the new host. |
Initialize | Used to initialize the migration manager with client and match information. |
LostHostOnClient | This should be called on a client when it has lost its connection to the host. |
LostHostOnHost | This should be called on a host when it has has been shutdown. |
ReconnectObjectForConnection | This re-establishes a non-player object with client authority with a client that is reconnected. It is similar to NetworkServer.SpawnWithClientAuthority(). |
ReconnectPlayerForConnection | This re-establishes a player object with a client that is reconnected. It is similar to NetworkServer.AddPlayerForConnection(). The player game object will become the player object for the new connection. |
Reset | Resets the migration manager, and sets the ClientScene's ReconnectId. |
SendPeerInfo | This sends the set of peers in the game to all the peers in the game. |
OnAuthorityUpdated | A virtual function that is called when the authority of a non-player object changes. |
OnClientDisconnectedFromHost | A virtual function that is called when the client is disconnected from the host. |
OnPeersUpdated | A virtual function that is called when the set of peers in the game changes. |
OnServerHostShutdown | A virtual function that is called when the host is shutdown. |
OnServerReconnectObject | A virtual function that is called for non-player objects with client authority on the new host when a client from the old host reconnects to the new host. |
OnServerReconnectPlayer | A virtual function that is called on the new host when a client from the old host reconnects to the new host. |
enabled | Enabled Behaviours are Updated, disabled Behaviours are not. |
isActiveAndEnabled | Has the Behaviour had enabled called. |
gameObject | El game object que tiene este componente adjunto. Un componente siempre está adjunto a un game object. |
tag | El tag de este game object. |
transform | The Transform attached to this GameObject. |
runInEditMode | Allow a specific instance of a MonoBehaviour to run in edit mode (only available in the editor). |
useGUILayout | Desactivar esto el deja a usted omitir la fase del diseño del GUI. |
hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
name | El nombre del objeto. |
BroadcastMessage | Llama al método denominado methodName de todos los MonoBehaviour en este game objecto en cualquiera de sus hijos. |
CompareTag | ¿Este game object está etiquetado con tag? |
GetComponent | Devuelve un componente de tipo type si el game object tiene a alguno adjuntado, o null si no lo tiene. |
GetComponentInChildren | Retorna el componente de tipo type en el GameObject o cualquiera de sus hijos utilizando depth first search (busqueda de profundidad). |
GetComponentInParent | Retorna el componente de tipo type en el GameObject o cualquiera de sus padres. |
GetComponents | Retorna todos los componentes de tipo type en el GameObject. |
GetComponentsInChildren | Retorna todos los componentes de tipo type en el GameObject o cualquiera de sus hijo. |
GetComponentsInParent | Retorna todos los componentes de tipo type en el GameObject o cualquiera de sus padres. |
SendMessage | Llama al método denominado methodName en cada MonoBehaviour de este game object. |
SendMessageUpwards | Llama al método denominado methodName en todos los MonoBehaviour de este juego y en todos los ancestros del behaviour. |
CancelInvoke | Cancela todas las llamadas de Invocación en este MonoBehaviour. |
Invoke | Invoca el método methodName en tiempo de segundos. |
InvokeRepeating | Invoca el método methodName en time segundos, luego repetidamente cada repeatRate segundos. |
IsInvoking | Hay una invocación methodName pendiente? |
StartCoroutine | Comienza una co-routine. |
StopAllCoroutines | Para todas las coroutines ejecutándose en este comportamiento. |
StopCoroutine | Para la primera coroutine llamada methodName, o la coroutine almacenada en routine ejecutando este comportamiento. |
GetInstanceID | Devuelve el id de la instancia del objeto. |
ToString | Returns the name of the GameObject. |
Los mensajes Logs a la consola de Unity (idéntico a Debug.Log). | |
Destroy | Elimina un gameobject, componente o asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. |
FindObjectOfType | Devuelve el primer objeto activo cargado de tipo type. |
FindObjectsOfType | Devuelve una lista de todos los objetos activos cargados de tipo type. |
Instantiate | Clona el objeto original y devuelve el clon. |
bool | ¿Existe el objeto? |
operator != | Compare si dos objetos se refieren a un objeto diferente. |
operator == | Compara dos referencias de objeto para ver si se refieren al mismo objeto. |
Awake | Awake se llama cuando la instancia del script está siendo cargada. |
FixedUpdate | Esta función se puede llamar cada frame de framerate fijo, si el MonoBehaviour está habilitado. |
LateUpdate | LateUpdate se llama cada frame, si Behaviour está habilitado. |
OnAnimatorIK | Callback para ajustar el IK (inverse kinematics) de animación |
OnAnimatorMove | Callback para procesar movimientos de animación para modificar movimiento raíz. |
OnApplicationFocus | Enviado a todos los GameObjects cuando el jugador obtiene o pierde foco. |
OnApplicationPause | Enviado a todos los GameObjects cuando la aplicación pausa. |
OnApplicationQuit | Sent to all game objects before the application quits. |
OnAudioFilterRead | Si OnAudioFilterRead es implementado, Unity insertará un filtro personalizado a la cadena de audio DSP. |
OnBecameInvisible | OnBecameInvisible se llama cuando el renderer ya no es visible por cualquier cámara. |
OnBecameVisible | OnBecameVisible se llama cuando el renderer se vuelve visible por cualquier cámara. |
OnCollisionEnter | OnCollisionEnter se llama cuando el Collider o Rigidbody entra en contacto con otro Collider/Rigidbody. |
OnCollisionEnter2D | Se envia cuando un collider entrante entra en contacto con el collider de este objeto (física 2D solamente). |
OnCollisionExit | OnCollisionExit se llama cuando este collider/rigidbody ha dejado de tocar otro rigidbody/collider. |
OnCollisionExit2D | Enviado cuando un collider en otro objeto para de tocar el collider de este objeto (física 2D solamente). |
OnCollisionStay | :ref::OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. |
OnCollisionStay2D | Enviado cada frame donde un collider en otro objeto está tocando el collider de este objeto (física 2D solamente). |
OnConnectedToServer | Llamado en el cliente cuando usted se ha conectado con éxito a un servidor. |
OnControllerColliderHit | OnControllerColliderHit se llama cuando el controller golpea a un collider mientras realiza un Move (movimiento). |
OnDestroy | Destroying the attached Behaviour will result in the game or Scene receiving OnDestroy. |
OnDisable | This function is called when the behaviour becomes disabled. |
OnDisconnectedFromServer | Llamado en el cliente cuando la conexión se ha perdido o usted se ha desconectado del servidor. |
OnDrawGizmos | Implementa OnDrawGizmos si usted quiere dibujar gizmos que también se recojan y siempre se dibujen. |
OnDrawGizmosSelected | Implementa OnDrawGizmosSelected para dibujar un gizmo si el objeto es seleccionado. |
OnEnable | Esta función se llama cuando el objeto se vuelve habilitado y activo. |
OnFailedToConnect | Llamado en el cliente cuando un intento de conexión falla por alguna razón. |
OnFailedToConnectToMasterServer | Llamado en los clientes o servidores donde hay un problema conectándose al MasterServer. |
OnGUI | OnGUI se llama para el rendering y el manejo de eventos GUI. |
OnJointBreak | Llamado cuando un joint adjuntado al mismo game object se rompe. |
OnJointBreak2D | Called when a Joint2D attached to the same game object breaks. |
OnMasterServerEvent | Llamado en clientes o servidores cuando se reporta eventos desde el MasterServer. |
OnMouseDown | OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider. |
OnMouseDrag | OnMouseDrag se llama cuando el usuario ha oprimido un GUIElement o Collider y todavía tiene presionado el mouse. |
OnMouseEnter | Llamado cuando el mouse ingresa el GUIElement o Collider. |
OnMouseExit | Llamado cuando el mouse no está más sobre el GUIElement o Collider. |
OnMouseOver | Llamado cada frame mientras que el mouse está sobre el GUIElement o Collider. |
OnMouseUp | OnMouseUp se llama cuando el usuario ha soltado el botón del mouse. |
OnMouseUpAsButton | OnMouseUpAsButton es solamente llamado cuando el mouse se suelta sobre el mismo GUIElement o Collider a medida que era presionado. |
OnNetworkInstantiate | Llamado en objetos que han sido instaciados en la red con Network.Instantiate. |
OnParticleCollision | OnParticleCollision se llama cuando una partícula golpea un Collider. |
OnParticleSystemStopped | OnParticleSystemStopped is called when all particles in the system have died, and no new particles will be born. New particles cease to be created either after Stop is called, or when the duration property of a non-looping system has been exceeded. |
OnParticleTrigger | OnParticleTrigger se llama cuando cualquier partícula en un sistema de partículas coincide con las condiciones en el módulo trigger. |
OnPlayerConnected | Llamado en el servidor cuando un nuevo player se ha conectado con éxito. |
OnPlayerDisconnected | Llamado en el servidor cuando un player se ha desconectado del servidor. |
OnPostRender | OnPostRender is called after a camera finished rendering the Scene. |
OnPreCull | OnPreCull is called before a camera culls the Scene. |
OnPreRender | OnPreRender is called before a camera starts rendering the Scene. |
OnRenderImage | OnRenderImage is called after all rendering is complete to render image. |
OnRenderObject | OnRenderObject is called after camera has rendered the Scene. |
OnSerializeNetworkView | Utilizado para personalizar la sincronización de variables en un script observado por un network view. |
OnServerInitialized | Llamado en el servidor cada vez que un Network.InitializeServer fue invocado y se ha completado. |
OnTransformChildrenChanged | Esta función se llama cuando la lista de hijos del transform del GameObject ha cambiado. |
OnTransformParentChanged | Esta función se llama cuando la propiedad padre del transform de este GameObject ha cambiado. |
OnTriggerEnter | OnTriggerEnter is called when the GameObject collides with another GameObject. |
OnTriggerEnter2D | Enviado cuando otro objeto ingresa a un trigger collider adjunto a este objeto (física 2D solamente). |
OnTriggerExit | OnTriggerExit se llama cunado el Collider other ha parado de tocar el trigger. |
OnTriggerExit2D | Enviado cuando otro objeto deja un trigger collider adjunto a este objeto (física 2D solamente). |
OnTriggerStay | OnTriggerStay is called once per physics update for every Collider other that is touching the trigger. |
OnTriggerStay2D | Enviado cada frame donde otro objeto está dentro de un trigger collider adjunto a este objeto (física 2D solamente). |
OnValidate | Esta función se llama cuando el script se ha cargado o un valor ha cambiado en el inspector (Llamado solamente en el editor). |
OnWillRenderObject | OnWillRenderObject is called for each camera if the object is visible and not a UI element. |
Reset | Se re-inicia a los valores predeterminados. |
Start | Start is called on the frame when a script is enabled just before any of the Update methods are called the first time. |
Update | Update se llama cada frame, si MonoBehaviour está habilitado. |