using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlaneTranform : MonoBehaviour
{
void Awake()
{
LoadByWWW();
//GetComponent<Material>().
}
private void LoadByWWW()
{
StartCoroutine(Load());
}
IEnumerator Load()
{
//请求WWW
WWW www = new WWW("file://D:\\timg.jpg");
yield return www;
if (www != null && www.isDone && string.IsNullOrEmpty(www.error))
{
Debug.Log(www.size);
Debug.Log("**********" + www.texture.width);
//获取Texture
GetComponent<Renderer>().material.mainTexture = www.texture;
}
}
}
GetComponent<Renderer>().material.mainTexture = www.texture; 一定要注意这个 别忘了
想要换的图片 = 加载得到的图片