Unity使用Url加载网络图片
程序员文章站
2022-05-16 11:23:25
...
IEnumerator DownLoadImgUserHead()
{
UnityWebRequest uwr = new UnityWebRequest("URL写在我这里", UnityWebRequest.kHttpVerbGET);
uwr.downloadHandler = new DownloadHandlerTexture();
yield return uwr.SendWebRequest();
Texture2D texture = DownloadHandlerTexture.GetContent(uwr);
imgUserHead.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
}
上一篇: 判断二叉树是否是平衡树
下一篇: openCV学习(一)Mat数据类型