=======================
=======================
=======================
출처: docs.unity3d.com/ScriptReference/NetworkReachability.ReachableViaLocalAreaNetwork.html
NetworkReachability.ReachableViaLocalAreaNetwork
//Attach this script to a GameObject
//This script checks the device’s ability to reach the internet and outputs it to the console window
using UnityEngine;
public class Example : MonoBehaviour
{
string m_ReachabilityText;
void Update()
{
//Output the network reachability to the console window
Debug.Log("Internet : " + m_ReachabilityText);
//Check if the device cannot reach the internet
if (Application.internetReachability == NetworkReachability.NotReachable)
{
//Change the Text
m_ReachabilityText = "Not Reachable.";
}
//Check if the device can reach the internet via a carrier data network
else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
{
m_ReachabilityText = "Reachable via carrier data network.";
}
//Check if the device can reach the internet via a LAN
else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
{
m_ReachabilityText = "Reachable via Local Area Network.";
}
}
}
=======================
=======================
=======================
출처: blog.daum.net/arkofna/18283247
Application.internetReachability
https://docs.unity3d.com/ScriptReference/NetworkReachability.ReachableViaLocalAreaNetwork.html
NetworkReachability
https://docs.unity3d.com/ScriptReference/NetworkReachability.html
Application.internetReachability 를 통해 인터넷 접속 상태를 확인할 수 있고,
NetworkReachability 를 통해 현재 어떤 통신 상태인지를 확인 할 수 있다.
void Update() { if (Application.internetReachability == NetworkReachability.NotReachable) { m_ReachabilityText = "Not Reachable."; } else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) { m_ReachabilityText = "Reachable via carrier data network."; } else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) { m_ReachabilityText = "Reachable via Local Area Network."; } } |
Not Reachable : 연결되어 있지 않음
Reachable via carrier data network : 4g 등, 통신사 데이터를 사용중
Reachable via Local Area Network : 로컬 데이터(wifi) 를 사용중
=======================
=======================
=======================
기타관련링크
- includecoding.tistory.com/12
- yeonhong.blogspot.com/2015/04/unity3d.html
=======================
=======================
=======================
'게임엔진관련 > 유니티 엔진' 카테고리의 다른 글
[Unity] 유니티 디바이스 결제(IAP) 연동 관련 (0) | 2021.02.16 |
---|---|
[Unity] 유니티 MD5 관련 (0) | 2021.02.04 |
[Unity] 유니티 Web빌드 유니티 타이니 Unity Tiny 설치 관련 (0) | 2020.11.10 |
c++서버 유니티엔진과의 네트워크 통신 관련 .NET C# 소켓통신과 IOCP서버C++형태의 서버와의 호환성문제 ? (0) | 2020.09.20 |
[Unity] Visual Studio Tools for Unity 사용, 스크립트열기, 코드디버깅 등등 관련 (0) | 2020.09.19 |