Exemplo n.º 1
0
        private static IEnumerator LoadTexture(ETTask <Texture2D> task, string path)
        {
            var webRequest = UnityWebRequestTexture.GetTexture(path);

            yield return(webRequest.SendWebRequest());

            if (webRequest.result != UnityWebRequest.Result.Success)
            {
                path.Log();
                Debug.LogError("LoadTexture Error:" + webRequest.downloadHandler.error);
                task.SetException(new Exception("LoadTexture Error"));
            }
            else
            {
                task.SetResult(DownloadHandlerTexture.GetContent(webRequest));
            }
        }