How to Find the Country Name From Untiy

Hi All I am trying to find my country name from unity. The Below code works from System. It did not works on iOS.
So whats i have to do

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class Location2 : MonoBehaviour
{
    // Start is called before the first frame update
    public byte[] results;
    public string str2;
    public string[] authorsList;
    public Text text;


    void Start()
    {
        StartCoroutine(GetText());
        Invoke("F", 3f);
    }

   public  IEnumerator GetText()
    {
        Debug.Log("Get Text");
        UnityWebRequest www = UnityWebRequest.Get("https://extreme-ip-lookup.com/json/");
        yield return www.SendWebRequest();

        if (www.isNetworkError || www.isHttpError)
        {
            Debug.Log(www.error);
        }
        else
        {
            // Show results as text
            Debug.Log(www.downloadHandler.text);
            str2 = www.downloadHandler.text.ToString();
            authorsList = str2.Split(' ');
          
            // Or retrieve results as binary data
      
        }
    }

    public void F()
    {
        text.text = authorsList[25];
// It displays country name
    }
    // Update is called once per frame
    void Update()
    {
      
    }
}

I dont want use any location based finding. Why the above code did not works on iOS.

No idea. We just use a $5 asset from the Asset Store called PreciseLocale and it works everywhere.

https://assetstore.unity.com/packages/tools/integration/precise-locale-65836

1 Like

@kurt Dekker thanks for you reply… I am trying with my code. Is is possible to find the country code through Unity Scripting. Even Php Also ok …