Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2023
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. Sprite downloadedSprite;
  2. IEnumerator GetImages()
  3. {
  4. Texture2D _texture;
  5. UnityWebRequest www = UnityWebRequestTexture.GetTexture(_store.LogoDownloadLink);
  6. yield return www.SendWebRequest();
  7.  
  8. if (www.result != UnityWebRequest.Result.Success)
  9. {
  10. Debug.Log(www.error);
  11. }
  12. else
  13. {
  14. _texture = ((DownloadHandlerTexture)www.downloadHandler).texture;
  15. Rect _rect = new Rect(0, 0, _texture.width, _texture.height);
  16. Sprite _sprite = Sprite.Create(_texture, _rect, new Vector2(0.5f, 0.5f), 100);
  17.  
  18. downloadedSprite = _sprite;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement