Version: 2017.2

ClientScene.SendReconnectMessage

Cambiar al Manual
public static bool SendReconnectMessage (Networking.MessageBase extraMessage);

Parámetros

extraMessage Any extra data to send.

Valor de retorno

bool Returns true if the send succeeded.

Descripción

Send a reconnect message to the new host, used during host migration.

An example usage might be that if you decide to spawn your own player and not use the built in "Auto Create Player" property in the NetworkManager together with HostMigration, you would need to send a reconnect message when your client reconnects. The code below illustrates such an example were we OnClientConnect check if we where disconnected from the host and in that case we send the reconnect message.

using UnityEngine;
using UnityEngine.Networking;

public class NetworkManagerEx : NetworkManager { public override void OnClientConnect(NetworkConnection conn) { base.OnClientConnect(conn);

if (migrationManager.disconnectedFromHost) { ClientScene.SendReconnectMessage(null); } } }