Hey there, i am using the FacepunchTransport and now i wanted to detect if the host himself lost internet connection and send him back to the main menu if so.
"OnClientDisconnectCallback" does not get called on the host himself when he loses internet.
Thats how i check if the host disconnected for the clients. But how would i do so for the host/server himself?
private void OnClientDisconnectCallback(ulong id) {
Debug.Log("OnClientDisconnectCallback: " + id.ToString());
if (IsClient) {
if (id == 0) { // 0 = host?!
LobbySaver.instance.currentLobby?.Leave();
LobbySaver.instance.currentLobby = null;
NetworkManager.Singleton.Shutdown();
SceneManager.LoadScene("MainMenu");
}
}
}
Hey there, i am using the FacepunchTransport and now i wanted to detect if the host himself lost internet connection and send him back to the main menu if so.
"OnClientDisconnectCallback" does not get called on the host himself when he loses internet.
Thats how i check if the host disconnected for the clients. But how would i do so for the host/server himself?