WebRequestForDXT
Never
public static async UniTask<Sprite> DownloadSpriteAsync(string url, CancellationToken interruptToken = default) { if (string.IsNullOrEmpty(url)) { return null; } // Creating and sending web request using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(url)) { request.SetRequestHeader("Cache-Control", "no-cache, no-store, must-revalidate"); request.SetRequestHeader("Pragma", "no-cache"); //TODO make Async! request.SendWebRequest(); // Creating task interuption logic. It will be interupted either globaly or locally. while (!request.isDone || interruptToken.IsCancellationRequested) { if (interruptToken.IsCancellationRequested) { Debug.Log("Task {0} cancelled"); request.Abort(); interruptToken.ThrowIfCancellationRequested(); } await UniTask.Yield(); } if (WebRequestError(request)) { Debug.LogWarning($"Error while downloading resource < {url} >, error: {request.error}"); return null; } Texture2D texture; if (!XRspaceOptions.Singleton.isMobile) { //cast DXT format if device is not mobile. texture = new Texture2D(0, 0, TextureFormat.ASTC_6x6, false); } else { texture = new Texture2D(0, 0, TextureFormat.DXT5, false); } texture = ((DownloadHandlerTexture)request.downloadHandler)?.texture; if (texture is null || texture.width == 0) { Debug.LogWarning($"Error while downloading resource < {url} >, error: Download result was null"); return null; } //if (texture.width % 4 == 0 && texture.height % 4 == 0) texture.Compress(true); //else Debug.Log($"Compression failed. Incorrect resolution {texture.width}x{texture.height}"); texture.Apply(); var rect = new Rect(0.0f, 0.0f, texture.width, texture.height); var pivot = new Vector2(0.5f, 0.5f); const float pixelsPerUnit = 100.0f; Sprite sprite = Sprite.Create(texture, rect, pivot, pixelsPerUnit); return sprite; } }
Raw Text
-
Lucy Heart takes the lead
24 min ago
-
BRIDE4K. That No-Good Cheater
54 min ago
-
Untitled
1 hour ago
-
Untitled
1 hour ago
-
Untitled
1 hour ago
-
I fuck the black cock builder and make him squirt on the terrace overlooking the entire city of Cali
1 hour ago
-
Untitled
1 hour ago
-
CP😏 VÍDEO🔥💯 R@PED😈 LITTLE GIRL🍆👧💦💦
1 hour ago
-
Untitled
1 hour ago
-
Untitled
1 hour ago