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连接还是数据连接或者已断开连接
最新推荐文章于 2022-09-24 12:39:08 发布