Version: 2017.1

ClientScene.SendReconnectMessage

Switch to Manual
public static bool SendReconnectMessage (Networking.MessageBase extraMessage);

Parameters

extraMessage Any extra data to send.

Returns

bool Returns true if the send succeeded.

Description

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); } } }