Skip to content

Commit 369cf43

Browse files
committed
Added publishing of disconnect reason when requesting disconnect while being no longer connected
1 parent 7fef46c commit 369cf43

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement/ClientGameNetPortal.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ public void OnUserDisconnectRequest()
102102
StopCoroutine(m_TryToReconnectCoroutine);
103103
m_TryToReconnectCoroutine = null;
104104
}
105+
106+
if (!m_Portal.NetManager.IsConnectedClient)
107+
{
108+
// If we are here, it means we will not receive the OnClientDisconnectCallback since we are already disconnected.
109+
// In that case, publish the disconnect reason and clear it now.
110+
m_ConnectStatusPub.Publish(DisconnectReason.Reason);
111+
DisconnectReason.Clear();
112+
}
105113
}
106114
}
107115

0 commit comments

Comments
 (0)