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.
1
void Start() {
2
NetworkClient.Instance.OnGameServerDisconnectedEvent += Instance_OnGameServerDisconnectedEvent;
3
}
4
​
5
void onDestroy() {
6
NetworkClient.Instance.OnGameServerDisconnectedEvent -= Instance_OnGameServerDisconnectedEvent;
7
}
8
​
9
private void Instance_OnGameServerDisconnectedEvent()
10
{
11
Debug.Log("OnGameServerDisconnectedEvent");
12
}
Copied!
Last modified 2yr ago
Copy link
Contents
Example