0
我可以成功加载的材料使用下面的代码保存在我的统一项目设置材料:团结 - 从下载的图像,而不是资源
RenderSettings.mat1 =(材料)Resources.Load(“图像/ img1.jpg “,typeof(Material));
但是,我现在试图通过下载它来加载外部图像。
Texture2D imgDownloaded;
string url = "http://www.intrawallpaper.com/static/images/1968081.jpg";
void Start()
{
StartCoroutine(getImg());
fucntionx();
}
public void functionx()
{
RenderSettings.mat1 = (Material)imgDownloaded;
}
IEnumerator getImg()
{
yield return 0;
WWW dl = new WWW(url);
yield return dl;
imgDownloaded = dl.texture;
}
但是,我得到的消息是我无法从Texture2D转换为材质。
有什么办法解决这个问题吗?