Unity 下载图片并保存(WWW)
来源:互联网 发布:绝地求生 dx12优化 编辑:程序博客网 时间:2024/05/16 14:20
首先通过扫描仪扫描图片保存到指定文件夹下,再通过WWW类下载保存到指定的其他文件夹下使用
using System.Collections;using System.Collections.Generic;using System.IO;using UnityEngine;public class DownLoadImage : MonoBehaviour { public static DownLoadImage _instance; public List<Texture2D> playerTextureList = new List<Texture2D>(); public MeshRenderer[] meshRenderers; private string httpSavePath; private bool isDownLoading; private int index = 1; void Awake() { _instance = this; } void Start() { httpSavePath = @"E:\xampp\htdocs\vr\"; StartCoroutine(GetImage()); } IEnumerator GetImage() { while (true) { if (isDownLoading) break; print("wait......"); yield return new WaitForSeconds(0.5f); print("DownLoading...."); } while (true) { if(index > 4) break; yield return StartCoroutine(Iamge1("http://192.168.1.103/vr/vrp_00000" + index + ".jpg")); Debug.Log("Iamge" + index + "finish"); index++; } } void Update() { CheckImageNumber(); } void CheckImageNumber() { DirectoryInfo di1 = new DirectoryInfo(httpSavePath); List<FileInfo> fi1 = new List<FileInfo>(); foreach (FileInfo item in di1.GetFiles()) { fi1.Add(item); } if (fi1.Count >= 4) isDownLoading = true; if (playerTextureList.Count >= 4) { for (int i = 0; i < playerTextureList.Count; i++) { meshRenderers[i].material.mainTexture = playerTextureList[i]; } } } IEnumerator Iamge1(string path) { WWW www = new WWW(path); yield return www; Texture2D texture = www.texture; playerTextureList.Add(texture); }}
阅读全文
0 0
- Unity 下载图片并保存(WWW)
- Unity3D, WWW下载图片并保存
- Unity3D, WWW下载图片并保存
- unity 下载图片使用并保存在本地
- 下载图片并保存
- AS3下载并保存图片
- scrapy 下载并保存图片
- Unity 截屏,WWW加载图片,保存到本地
- Android-okhttp下载图片并保存(刷新图库)
- 用curl下载一张图片并保存
- 异步下载网络图片并保存
- Unity中手机端WWW读取图片并显示
- Unity如何使用WWW类和协程完成图片、视频下载播放(一)
- Unity如何使用WWW类和协程完成图片、视频下载播放(一)
- unity-www下载
- unity www缓存图片
- android-下载保存网络图片并显示下载进度条
- unity截取相机所看到的内容并保存图片
- c/c++中嵌入汇编
- 【阅读】数据可视化之美——用专家的眼光洞察数据
- linux解压*.tgz出现异常的解决办法
- IntelliJ IDEA创建Spring Maven 项目
- apk反编译
- Unity 下载图片并保存(WWW)
- gcov和lcov
- HDU2680 Choose the best route (最短路)(Dijkstra算法)
- Httpservlet源码及实现机制详解
- java.lang.NoSuchMethodError: redis.clients.jedis.JedisShardInfo.setTimeout(I)V
- Advanced Django Models
- 2015美国闪存峰会特稿——NVMe + RDMA = 非凡的性能!
- div中img和a链接同时居中
- Android App 启动页(Splash)黑/白闪屏现象产生原因与解决办法