unity3d检测网络是wifi连接还是数据连接或者已断开连接
作者:
好怕怕 | 来源:发表于
2017-04-21 15:32 被阅读309次using UnityEngine;
public class NwtWork : MonoBehaviour
{
private float time = 0f;
void Update()
{
time += Time.deltaTime * 1;
if (time >= 1)
{
time = 0f;
switch (Application.internetReachability)
{
case NetworkReachability.NotReachable:
Debug.LogError("网络断开");
break;
case NetworkReachability.ReachableViaLocalAreaNetwork:
Debug.LogError("WIFI");
break;
case NetworkReachability.ReachableViaCarrierDataNetwork:
Debug.LogError("4G/3G");
break;
}
}
}
}
本文标题:unity3d检测网络是wifi连接还是数据连接或者已断开连接
本文链接:https://www.haomeiwen.com/subject/pdvdzttx.html
网友评论