Back to Unity

DryreL Software Unity

Offline Network Manager

Detect and handle connectivity changes in Unity

Know when the player goes offline and back online, without wasting battery. Available now on GitHub.

Available on GitHub

  • 5 s to 1 hAdaptive check interval
  • 7Platforms, consoles too
  • MITFree on GitHub

Overview

What it does

A singleton manager that detects internet connectivity changes in Unity, with adaptive check intervals that save battery on stable connections.

  • Unity
  • C#
  • MIT license

Platforms

  • Windows
  • macOS
  • Linux
  • WebGL
  • Android
  • iOS
  • Consoles

Gallery

See it in action

Offline Network Manager by DryreL Hub and DryreL Software
Offline Network Manager for Unity.

Features

Built to just work

  • Adaptive intervalsChecks more often when the state changes and less often when the connection is stable, to save battery.
  • Reconnection detectionBuilt-in retry logic with a configurable debounce.
  • Event drivenSubscribe in code, or wire UnityEvents in the inspector with no code at all.
  • Offline backupBuilt-in PlayerPrefs backup and restore for offline persistence.
  • Scene persistentLives across scene loads and starts on its own.

Reference

Adaptive check intervals

Connection durationDefault intervalWhy
First minute5 secondsQuickly catch state changes
1 to 10 minutes10 secondsModerate monitoring
10 to 60 minutes30 secondsStable connection, check less
1 to 10 hours10 minutesLow frequency
Over 10 hours1 hourSave battery

Good to know: Every interval is editable in the inspector, together with the sync retry debounce (60 seconds by default), network warnings and debug logs.

Get started

Install and use

Install

Window > Package Manager > + > Add package from git URL...
https://github.com/DryreL/Unity-OfflineNetworkManager.git?path=/Assets/Plugins/DryreLHub/OfflineNetworkManager

Usage

OfflineNetworkManager.Instance.OnInternetConnectivityChanged += isOnline =>
    Debug.Log(isOnline ? "Back online" : "Offline");

Requirements

Before you start

  • Unity with the Newtonsoft Json package (com.unity.nuget.newtonsoft-json)