Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

How to return value from UnityWebRequest?

$
0
0
I have a script that connects to the database and retrieve data. The GetData function is called by other script. is there a way that I can return the data back to the caller? public IEnumerator GetData(){ using (UnityWebRequest wwww = UnityWebRequest.Get("http://localhost/BMS/LoadGame.php")) { yield return wwww.SendWebRequest(); if (wwww.isNetworkError || wwww.isHttpError){ Debug.Log(wwww.error); } else { Debug.Log(wwww.downloadHandler.text); //How to return the result to the caller? } } } The method that I know is to call another function in other script to pass the data, but this is a lot more troublesome. Is there any direct way that I can return the data to the caller? Thanks!

Viewing all articles
Browse latest Browse all 387

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>