public IEnumerator AVGCollectors() { //Login to the website and wait for a response WWW w = new WWW("http://81.169.177.181/OLP/avg_data.php"); yield return(w); //Check if the response if empty or not if (string.IsNullOrEmpty(w.error)) { //Return the json array and put it in the C# AverageData class Averagedata avgdata = JsonUtility.FromJson <Averagedata>(w.text); if (avgdata.success == true) { //Check if there is any error in the class. If there is return the error if (avgdata.error != "") { Debug.Log("avg.error"); } else { PlanetManager.SetAVG(avgdata); PlanetManager.InitMainPlanet(); Debug.Log("average data imported successful."); } //If the JsonArary is empty return this string in the feedback } else { Debug.Log("An error occured."); } //If the string is empty return this string in the feedback } else { // error Debug.Log("An error occured."); } }
public void SetAVG(Averagedata avg) { AverageData = avg; }