Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

I cant get response json from rest call in Unity

$
0
0
Hi all, I had a problem while using www class for rest calls. I wrote the following code. void Start () { WWW www = new WWW ("http://ip.jsontest.com/"); StartCoroutine(WaitForRequest (www)); } private IEnumerator WaitForRequest(WWW www) { yield return www; // check for errors if (www.error == null) { print (www.text); } else { print ("error: "+www.error); } } "http://ip.jsontest.com/" this url returns simple json that shows an ip. Ex: { "ip": "193.202.18.14" } But I didnt get that json in unity. What i get is below. IIS Windows Server
IIS
UnityEngine.MonoBehaviour:print(Object)c__Iterator0:MoveNext() (at Assets/ApplicationController.cs:56) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) I have read many documents and I have tried many solutions but I couldn't solve it. How could i get that json? Thanks,

Viewing all articles
Browse latest Browse all 215

Trending Articles