Hi! In my WEBGL project, i download an assetbundle from the server and i want to make some progressbar for it. So, in editor everything works, i get Content-Length header and www.downloadedprogress returns the correct value. But in browser, the collection of headers is empty and progress is always 0 I tried to get Content-Length header by HEAD request, but it returns empty collection as well. Heres my code: Code (CSharp): IEnumerator DownloadSceneAsset() { using (UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(url)) { StartCoroutine(ShowProgress(www)); yield return www.SendWebRequest(); AssetBundle assetBundle = DownloadHandlerAssetBundle.GetContent(www); //some other code here... } } IEnumerator ShowProgress(UnityWebRequest www) { while (!www.isDone) { progress.text = (www.downloadProgress * 100f).ToString("0") + "%"; yield return null; } } And tried this: Code (CSharp): IEnumerator GetContenSize() { using (UnityWebRequest www = UnityWebRequest.Head(url)) { yield return www.SendWebRequest(); print(www.GetResponseHeaders().ContainsKey("Content-Length")); ... foreach (var item in www.GetResponseHeaders()) { print(item.Key + " | " + item.Value); } } } No cors problems, the client has been hosted. Everything works exept i dont know the progress of downloading in webgl build. Thx!
Can you try : Code (CSharp): IEnumerator DownloadSceneAsset() { UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(url); www.SendWebRequest(); while (!www.isDone) { progress.text = (www.downloadProgress * 100f).ToString("0") + "%"; yield return null; } AssetBundle assetBundle = DownloadHandlerAssetBundle.GetContent(www); }
this is my htacess: AddType application/x-shockwave-flash .swf <IfModule mod_mime.c> AddEncoding gzip .unityweb </IfModule>