How to check Internet Connection like Clash of Clans

Hello guys.
Here I have an game. And this is an online game.

Now, I want to create “check internet connection”. I want this game is connected to internet when I play this game. It is like Clash of clans that if the “connection” lost, this will show a “dialogue box” to connect to internet again.

Help me to create the C# script guys… Thanks…!!!

please… please help guys…

Basically checking the device’s network status doesn’t help much, the way it should work is that if you have a server then when you see the client can not communicate to the server and messages timeout, you show the dialog. for testing connection you can try to fetch a webpage or something to see if the connection works or not.

yes, I mean like that bro…
I have a server, and I want to check connection to my server… if there is no internet connection and can to connect to my server, the dialogue box will appear… Would you help me about the C# code…?
Thanks…

maybe this? Unity - Scripting API: Ping

There’s so much more to this. For instance, what approach do you want to take? Are you going to have a single server that all clients connect to? If so, why not just immediately upon launch (of the game) attempt to connect to the server. If there’s no internet connection, this obviously won’t go through, and you can bring up your dialogue.