Unity www获取的图片如何转换为sprite

通过Texture2D tex = www.texture的方法虽然编译不会报错,但是无法转换。可以通过

 Texture2D tex = new Texture2D(100, 100);
 www.LoadImageIntoTexture(tex);
 Sprite sprite = Sprite.Create(tex, new Rect(0, 0, 100,100), Vector2.zero);
 showImage.sprite = sprite;
来实现。关键是www的LoadImageIntoTexture方法。

猜你喜欢

转载自blog.csdn.net/skylovecrayon/article/details/80093548
今日推荐