///判断是否有网络,如果没有
if (Application.internetReachability == NetworkReachability.NotReachable)
{
//如果没有网络
isHaveNetWoek = false;
enabled = false;
}
if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
{
//如果是WIFI在线
enabled = true;
isHaveNetWoek = true;
}
if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
{
//如果是移动网络
enabled = true;
isHaveNetWoek = true;
}
Unity中判断是否有网络
最新推荐文章于 2024-07-19 15:03:17 发布