unity工具————网络判断

 static class Tools
{
    //是否是WIFI
    public static bool IsWiFI{ get { return Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork; } }
    //是否是移动网络
    public static bool Is4G{ get { return Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork; } }
    //网络是否不可用
    public static bool IsNotReachable{ get { return Application.internetReachability == NetworkReachability.NotReachable; } }

}

猜你喜欢

转载自blog.csdn.net/kill566666/article/details/80774396