- CheckConnection isimli script oluşturun.
- Sahnede boş bir objenin içine ekleyin.
- Hem Wifi hem Hücresel Veride çalışması gerekir.
using Systems;
using UnityEngine;
using UnityEngine.UI;
public class CheckConnection : MonoBehaviour
{
public Text networkText;
private void Start()
{
StartCoroutine(checkInternetConnection((isConnected)=>{
if (isConnected)
{
// BAĞLANTI BAŞARILI İSE YAPTIRMAK İSTEDİKLERİNİZ
networkText.Text = "BAĞLANTI BAŞARILI"
}
else
{
// NET YOK İSE YAPTIRMAK İSTEDİKLERİNİZ
networkText.Text = "BAĞLANTI BAŞARISIZ LÜTFEN YENIDEN DENEYİM"
}
}));
}
IEnumerator checkInternetConnection(Action<bool> action)
{
WWW www = new WWW("http://google.com");
yield return www;
if (www.error != null)
{
action (false);
}
else
{
action (true);
}
}
}
teşekkür ederim
test edebildiniz mi acaba
hata veriyor