Unity中 测试从服务器获取的图片
2018-01-25 10:15
441 查看
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); } } }
相关文章推荐
- ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结
- 用HTML5获取摄像头图像,并且上传图片到服务器(代码完整可用)
- 通过拍照或者图库获取图片并上传服务器
- boost aio多线程服务器与unity 程序连接 测试代码
- V4L2摄像头获取单幅图片测试程序
- iOS中(相册)摄像头获取的图片上传至服务器被自动旋转了
- laravel 远程服务器获取图片,解决前端显示图片跨域问题
- Android:读取本地相册与相机获取图片上传到服务器(用字符串的形式上传)
- ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结
- Unity获取本地图片并保存后使用
- Unity_ngui_从网络获取图片资源
- 关于url从服务器上获取图片资源
- 关于url从服务器上获取图片资源
- 获取服务器上的图片
- ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结
- ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结
- 从服务器获取数据(此处为图片获取)
- Android从服务器获取图片的实例方法
- ios中摄像头/相册获取图片,压缩图片,上传服务器方法总结
- 获取服务器微信头像更改不同规格图片大小