浏览代码

I thought this had been working correctly with the initial changes, but I guess not? Anyway, adding a frame delay from the RelayUtpClient's Disposal before Destroying it to ensure the disconnect message reaches the host.

/main/staging/ready_when_player_leaves
nathaniel.buck@unity3d.com 3 年前
当前提交
8c5a2c63
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 11
      Assets/Scripts/Game/GameManager.cs

11
Assets/Scripts/Game/GameManager.cs


if (m_relayClient != null)
{
m_relayClient.Dispose();
Component.Destroy(m_relayClient);
m_relayClient = null;
StartCoroutine(FinishCleanup());
// We need to delay slightly to give the disconnect message sent during Dispose time to reach the host, so that we don't destroy the connection without it being flushed first.
IEnumerator FinishCleanup()
{
yield return null;
Component.Destroy(m_relayClient);
m_relayClient = null;
}
}
}

正在加载...
取消
保存