Class NetworkModule
Provides internet connectivity checking and background polling. Exposes a one-shot CheckInternetConnectionAvailable() for on-demand checks, and a polling loop that fires OnInternetStatusChanged when reachability changes. The polling loop automatically pauses when the app is backgrounded.
public static class NetworkModule
- Inheritance
-
NetworkModule
- Inherited Members
Properties
- IsInitialized
Whether the module has been successfully initialized.
- IsInternetAvailable
The connectivity state as of the most recent poll.
Initialization
- Initialize()
Creates the MonoBehaviour runner that handles app pause/resume lifecycle.
Methods
- CheckInternetConnectionAvailable()
Pings multiple DNS endpoints in parallel and returns
trueas soon as any responds. Returnsfalseimmediately if Application.internetReachability isNotReachable.
- Disable()
Stops the polling loop and clears all OnInternetStatusChanged subscribers.
- Enable(float, int)
Starts the background polling loop.
Events
- OnInternetStatusChanged
Fired when connectivity transitions from available to unavailable or vice versa.