Skip to content

Instantly share code, notes, and snippets.

@hirojun5670
Created April 7, 2015 13:49
Show Gist options
  • Save hirojun5670/d7f04c6c381162da3de6 to your computer and use it in GitHub Desktop.
Save hirojun5670/d7f04c6c381162da3de6 to your computer and use it in GitHub Desktop.
UnityでWWW
using UnityEngine;
using System;
using System.Collections;
public class WebRequestAPI : MonoBehaviour {
// Use this for initialization
void Start () {
StartCoroutine (Request("https://www.google.co.jp", ResponceAction));
}
// Update is called once per frame
void Update () {
}
private IEnumerator Request(string url, Action<WWW> action){
WWW www = new WWW (url);
yield return www;
action (www);
}
private void ResponceAction(WWW www){
Debug.Log (www.text);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment