Quantcast
Channel: Questions in topic: "obj"
Viewing all articles
Browse latest Browse all 167

UnityWebRequest work only on odd tries

$
0
0
I am downloading an obj runtime, but the download call work only on odd tries. if I try to download first time it work, second time is not working (don't go after yield return uwr.SendWebRequest();) the third time is working again and so on... anyone can help me? IEnumerator GetObjectRoutine(Action callback) { GameObject loadedObj = null; UnityWebRequest.ClearCookieCache(); using (UnityWebRequest uwr = new UnityWebRequest("http://127.0.0.1:8887/Models/174-l2.obj", UnityWebRequest.kHttpVerbGET)) { string path = Path.Combine(Application.persistentDataPath, "model.obj"); uwr.downloadHandler = new DownloadHandlerFile(path); yield return uwr.SendWebRequest(); if (uwr.isNetworkError || uwr.isHttpError) Debug.LogError(uwr.error); else { Debug.Log("File successfully downloaded and saved to " + path); objectPath = path; loadedObj = new OBJLoader().Load(path); downloadedObj = loadedObj; uwr.Dispose(); } } if(loadedObj != null) callback?.Invoke(loadedObj); Debug.Log("EXIT FROM GETOBJECT"); }

Viewing all articles
Browse latest Browse all 167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>