UDP クライアントイベント - OnOffline

このイベントは、接続されたサーバーがオフラインになる準備をしているときに発生します。このイベントが発生した場合、クライアントは現在の接続を終了し、新しい接続を再確立する必要があります。

udp.OnOffline += OnUdpOffline;

udp.OnConnect += OnUdpConnect;

private void OnUdpOffline()
{
  // We set a flag, so we can perform re-connection in OnDisconnect event listener
  reconnectFlag = true;

// We migrate to another server - This raises OnConnect event
udp.Migrate();
}

// bool reconnecting is set to true when the client re-establishes a connection
private void OnUdpConnect(bool reconnecting)
{
  if (reconnectFlag)
  {

  }

// Continue with your live :)

}