Last updated 5 years ago
The NetworkClient invokes the following event to help you detect connectivity issues.
In this example, we added a listener to the OnGameServerDisconnectedEvent events in the Start() method and removed the listeners in the OnDestroy() method.
void Start() { NetworkClient.Instance.OnGameServerDisconnectedEvent += Instance_OnGameServerDisconnectedEvent; } void onDestroy() { NetworkClient.Instance.OnGameServerDisconnectedEvent -= Instance_OnGameServerDisconnectedEvent; } private void Instance_OnGameServerDisconnectedEvent() { Debug.Log("OnGameServerDisconnectedEvent"); }
Event
OnGameServerDisconnectedEvent
Invoked when the local player failed to receive the heartbeat reply from the room game server in the last 8 seconds.