void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Download random data")) { byte[] randomData = new byte[Random.Range(200, 500)]; for (int i = 0; i < randomData.Length; i++) { randomData[i] = (byte)Random.Range(0, 256); } WebDownloadHelper.InitiateDownload("ExampleFile.dat", randomData); } if (GUILayout.Button("Download text file")) { WebDownloadHelper.InitiateDownload("Textfile.txt", text); } GUILayout.EndHorizontal(); text = GUILayout.TextArea(text, GUILayout.ExpandHeight(true)); GUILayout.EndArea(); }
private List <Person> GetPeople() { List <Person> peopleList = null; using (var httpResponseMessage = WebDownloadHelper.Get(DataSourceUrl)) { httpStatusCode = httpResponseMessage.StatusCode; if (httpResponseMessage.IsSuccessStatusCode) { var responseText = WebDownloadHelper.ReadString(httpResponseMessage).Result; try { peopleList = JsonHelper.Deserialize <List <Person> >(responseText); } catch (ArgumentException) { IsInitialized = true; throw; } } } IsInitialized = true; return(peopleList); }