unity动态加载图片

IEnumerator loadImage()
{
WWW www = new WWW("http://u3dchina.com/template/singcere_dw/common/images/logo.png");
yield return www;
txt2d = new Texture2D(4, 4, TextureFormat.DXT1, false);
www.LoadImageIntoTexture(txt2d);//Resources.LoadAssetAtPath("http://u3dchina.com/template/singcere_dw/common/images/logo.png", typeof(Texture)) as Texture;
GameObject.Find("Game1BG").GetComponent().mainTexture = txt2d;
}

猜你喜欢

转载自blog.csdn.net/twicetwice/article/details/81103118
今日推荐