using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Http : MonoBehaviour {
// Use this for initialization
void Start () {
StartCoroutine("RequestServer");
}
public IEnumerator RequestServer()
{
string url = "http://127.0.0.1:8090";
WWW www = new WWW (url);
yield return www;
if (string.IsNullOrEmpty (www.error)) {
string resultData = www.text;
Debug.Log (resultData);
Texture texture = www.texture;
Debug.Log (texture.name);
if (texture != null) {
Debug.Log("texture不为空");
GameObject subObj = GameObject.CreatePrimitive (PrimitiveType.Quad);
Material mat = new Material (Shader.Find("Transparent/Diffuse"));
mat.mainTexture = texture;
subObj.GetComponent<Renderer> ().material = mat;
} else {
Debug.Log ("texture 是空的");
}
}else{
Debug.Log (www.error);
}
}
}
承接ARKit案例开发/宣传Demo开发/游戏开发 QQ:2118590660