Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PanCrucian · Dec 11, 2013 at 06:17 PM · wwwprogress

WWW.progress not working on Android | iOS

Hello. I'm having difficulty tracking progress using a WWW class. On mobile platforms WWW.progress value does not change linearly, it is 0 (when loading) or 1 (when the finish).

On PC & MAC all Ok. I mean that the PC value goes smoothly from 0 to 1 (0.1 0.2 0.3 .... 1). But on mobile platforms this is not happening! Is 0 or 1, no 0.2 0.4 etc.. Rigidly 0 or 1. Help! Unity 4.3.0f4 Pro

 using UnityEngine;
 using System.Collections;
 
 public class ExampleLoadingBundle : MonoBehaviour {
     public string url = "http://pancrucian.littleteam.ru/myAssetBundle.unity3d";
     public int version = 1; // The version of the AssetBundle
     
     public string assetName = "Object Name";
     public tk2dTextMesh textMesh;
     public AudioSource ObjInstance;
 
     void Start(){
         StartCoroutine(LoadBundle<AudioClip>(url, version,assetName));
     }
 
     public IEnumerator LoadBundle<T> (string url, int version, string assetName) where T : Object {
         using(WWW download = WWW.LoadFromCacheOrDownload(url, version)){
             while(!download.isDone) {                
                 textMesh.text = download.progress.ToString(); // THIS PART NOT WORKING, PROGRESS ALWAYS 0 THEN 1 IF download.isDone
                 textMesh.Commit();
                 yield return 0;
             }
             yield return download;
             if (download.error != null) {
                 textMesh.text = download.error;
                 download.Dispose();
                 textMesh.Commit ();
                 yield break;
             }
             
             AssetBundle assetBundle = download.assetBundle;
             download.Dispose();
             
             if (assetName == "" || assetName == null)
                 ObjInstance.clip = (AudioClip)assetBundle.mainAsset;
             else
                 ObjInstance.clip = (AudioClip)assetBundle.Load(assetName, typeof(T));
             
             assetBundle.Unload(false);
         }
         ObjInstance.Play();
     }
 }

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Julien-Lynge · Dec 11, 2013 at 06:37 PM 3
Share

Typically you see this behaviour when the server is returning bad header information. If it's not returning a content length, Unity has no way of giving you progress, since progress is a percentage of the total content length.

Is the server you're contacting giving back different headers depending on whether you're connecting from a mobile client or not?

avatar image kevinatgame Julien-Lynge · Jan 15, 2016 at 06:08 AM 0
Share

thank you!

avatar image PanCrucian · Dec 12, 2013 at 02:30 PM 0
Share

i check thx

avatar image PanCrucian · Dec 12, 2013 at 02:38 PM 0
Share

checked: on my server content length not returning on mobile devices ;(

avatar image PanCrucian · Dec 12, 2013 at 04:31 PM 0
Share

Fix server. All ok

avatar image Rbhaniwal PanCrucian · Mar 17, 2016 at 05:49 AM 0
Share

i have faced this same issue from last couple of days on web player. can you help me how could i fix my server. pls explain me step by step . Thanks in advance.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by PanCrucian · Dec 12, 2013 at 05:39 PM

Thx this guy http://answers.unity3d.com/users/14179/noaa-julien.html

Typically you see this behaviour when the server is returning bad header information. If it's not returning a content length, Unity has no way of giving you progress, since progress is a percentage of the total content length.

Server code:

 $attachment_location = 'files/myAssetBundle.unity3d';
 header($_SERVER["SERVER_PROTOCOL"] . " 200 OK");
 header("Cache-Control: public");
 header("Content-Type: application/zip");
 header("Content-Transfer-Encoding: Binary");
 header("Content-Length:".filesize($attachment_location));
 header("Content-Disposition: attachment; filename=myAssetBundle.unity3d");
 readfile($attachment_location);
 Die();
 

And now all working great! ;p

Comment
Add comment · Show 8 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Julien-Lynge · Dec 12, 2013 at 05:40 PM 1
Share

Glad to hear that it was that easy!

avatar image Conferno · Mar 01, 2014 at 08:25 AM 0
Share

Okay, i have same with www.progress trouble on webplayer build(when strea$$anonymous$$g video in movie texture). Where i must Paste that Server code ? What changes i must to do in that code for .ogv video file ?

avatar image Rbhaniwal Conferno · Mar 17, 2016 at 06:11 AM 0
Share

have you got solution for problem ?? I am facing this same issue from the last couple of days. Any solution ??

avatar image VrTechEx · Mar 07, 2016 at 01:58 PM 0
Share

Is there any way to changes the c# script in Unity to read the right header ins$$anonymous$$d of the Server itself?

avatar image arymangupta · Jun 25, 2016 at 02:16 PM 0
Share

Can you tell me what is the file type (extention) of asset bundle 'cause i tried using .unity3d to download asset bundle it doesnt work.

avatar image kokare97 · Oct 04, 2017 at 06:49 PM 0
Share

Can you tell where to put this code, and what to write for assetbundles

avatar image jerryking_ kokare97 · Nov 29, 2018 at 01:07 AM 0
Share

Hello, i have the same problem,have you solved it?

avatar image PanCrucian jerryking_ · Nov 29, 2018 at 05:49 AM 0
Share

That a PHP code, but it doesn't really matter in which program$$anonymous$$g language it is written. The idea is to transmit the response headers. Learn about HTTP headers

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there a way to estimate file size from www class downloaded from Dropbox 1 Answer

www.uploadProgress not working on Android 0 Answers

Server requirement for WWW.uploadProgress to work? 0 Answers

www progress ie 8 2 Answers

Texture loading via www.texture not loading! 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges