Network Status Event (beta)

The NetworkClient invokes the following event to help you detect connectivity issues.

Event

​

OnGameServerDisconnectedEvent

Invoked when the local player failed to receive the heartbeat reply from the room game server in the last 8 seconds.

Example

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");
}