Welcome, Guest! Login | Register
Internet Connection check in Unity
137 Posts

So... you're making a Multiplayer game... one thing you need to know before you even load the menu of your game is one thing...

Does the player have an active internet connection?

If they don't and they start your game and you don't have any validation, it could mess some thing's up.

Here's a quick way to check for an Internet Connection in Unity. Here's a quick sample function that will do everything for you...

#region Internet Connection
/// <summary>
/// Checks to see if there is an Internet Connection, by Cable or by WiFi
/// </summary>
/// <returns></returns>
public static bool IsNetworkAvailable()
    if (Application.internetReachability == NetworkReachability.NotReachable) return false;
    else return true;

Copied from my own Extensions class.

Hope this helps you in development!
Created on: 5 months ago
199 Posts

I actually implemented this back in FFArena, with a small globe in the upper right corner. It either had a green or red outline, depending on your connection. If you started the game while you were offline, the welcome message was different too, telling you that you need an internet connection to play the game.
Created on: 5 months ago
Edited on: 5 months ago
137 Posts

Exactly, this is a good feature to have. So hopefully ayone else starting Unity can use it to. Thanks for the reply, mate
Created on: 4 months ago
Or use the advanced reply form here...