using UnityEngine;
using System.Collections;
public class Main : MonoBehaviour {
public string url = "http://www.google.com";
public string output = "(ここに結果を表示)";
private GetViaHttp http;
void Start() {
http = GetComponent<GetViaHttp>();
}
void OnGUI() {
// Button
if(GUI.Button(new Rect(30, 30, 100, 30), "GET via HTTP")) {
Debug.Log("GET!!!");
StartCoroutine("GetUrl");
}
// TextArea for Output
GUI.TextArea(new Rect(30, 70, 800, 600), output);
}
private IEnumerator GetUrl() {
Debug.Log("Start2");
WWW www = new WWW(url);
yield return www;
Debug.Log(www.text);
output = www.text;
}
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme