-1

I have a simple issue but there is no straightforward answer to this issue.

How to disable entire internet connection when Unity3D games started? For Instance, create a total offline mobile game?

+I have Unity3D Pro version. +Unity HW statistics disabled.

Thanks.

derHugo
  • 83,094
  • 9
  • 75
  • 115
Rehb
  • 81
  • 1
  • 9
  • Did you see tihs post? https://stackoverflow.com/questions/39111324/enable-disable-wifi-on-android-in-unity – Chik3r Mar 05 '18 at 07:15

1 Answers1

2

It is possible to do but not simple. I assume when you say mobile devices, this includes both Android and iOS.

This functionality is not build into Unity. There are two steps to do this:

What to do:

1.Disable Wifi

2.Disable Mobile Data

The entire internet connection should be killed when you do both of this.

How to do it:

You will have to make a plugin to do this. This is platform dependent and you must know basic Java (for Android) and Object-C(for iOS) in order to do this.

Google "How to disable wifi on Android with Java" and also "How to disable mobile data on Android with Java". Convert that into a plugin. That's basically a simple function that you can call from C# to toggle wifi or mobile data on/off.

Do the-same thing for iOS. Take the Object-C code and turn into a plugin then call it from C#.

As for how to build the plugin for each platform, this can be found with a little bit of research. There is no other way to do this. My other post shows how to enable/disable wifi on Android only but that's just part of what to do in this answer. You still need a way to disable mobile data.

Programmer
  • 121,791
  • 22
  • 236
  • 328