Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Web GL Loading Slow - Progress Bar Possible?

Discussion in 'WebGL' started by John-B, Mar 6, 2015.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,250
    The WebGL version of my app takes FOREVER to load. I think I've optimized as much as possible. I got the total file size down to around 40 MB, down from over 150 MB with no optimizations (Unity Web Player file is 700 K, a small project). But it still takes a LONG time to load with nothing to see but a blank window. Users are going to think it's not working. After 20-30 seconds, I think it's not working, but eventually it does finish loading. Is there any way to show a progress bar? Anything that would indicate something is happening would be an improvement.
     
  2. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,250
    Just did some testing. On my computer, the WebGL version took 28 sec to load, on another Mac, same network, it took 45 sec. The Web Player version takes around 5-7 sec, but shows a progress bar. Anything over about 5 sec is TOO long without some sign of something happening.

    One other thing, after closing the Safari window with the Unity WebGL content, Safari consistently hangs (wait cursor spinning) for several minutes before I can do anything.
     
    Last edited: Mar 6, 2015
  3. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,250
    I just spoke with a tester who reported that it took 70 sec to load on his Mac laptop. Another tester was unable to get it to load at all in Chrome or Firefox on Windows.
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Do you have a link to your content to try?
     
  5. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,250
    http://www.polyhedronlearning.com/hsvpl/newtonssecondlaw/newton2homeframeset.html

    The Simulation link on the left opens the Unity Web Player version, the Simulation - WebGL link opens the WebGL version. The WebGL version can take a minute or more to load, so please be patient, it will finish eventually (unless you're on Windows).

    I've played around a bit, and can't see a way to add any text or anything in the Unity frame to let the user know they're in for a LONG wait.

    FWIW, we're doing the WebGL version strictly for Chromebook users. Apparently, Chromebooks are becoming quite popular in the education market, and our publisher is getting complaints about this product not running on Chromebooks. Unfortunately, we don't have a Chromebook, and can't test on that platform.
     
    Last edited: Mar 9, 2015
  6. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Ok, two comments from looking at the url:

    1. It seems that you are either using the "Minimal" Template for WebGL, which does not have a progress bar, or you stripped the progress bar code when integrating the build into your web page. The "Default" WebGL template will implement a progress bar. You can also change the progress bar code or write your own if you prefer.

    2. It looks like the server is serving the Newton2.data and Newton2.js files uncompressed. If you enable gzip compression on the server, the download will be much smaller and faster. Check the comments on gzip compression here: http://docs.unity3d.com/Manual/webgl-building.html
     
  7. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,250
    I did use the Manual setting, but the Default setting doesn't have a progress bar either. I tried it, and it shows the Unity WebGL logo and the name of the file below, but no progress bar.

    Correction: There IS a progress bar, but it DOESN'T show when I build and run in Unity. It does however show up when I upload the files and run it from the server.

    I can't turn on GZIP compression with my ISP (not 100% sure on that). When testing is done, it will be up to our publisher to deal with server-side issues.
     
    Last edited: Mar 11, 2015
  8. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    That is probably because the downloads are instantaneous when done on the local machine.
     
  9. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    Same here. The download step does not show the progress bar. It appears only at the "Preparing.../Running" step with almost 90% of the bar filled.

    Its text is also always "Downloading (0.0 / 1)"
     
  10. ahmadian

    ahmadian

    Joined:
    Nov 24, 2015
    Posts:
    44
    In my case , the game takes forever to start showing the progress bar and when it sows , it's empty and starts loading from beginning . this progress takes about 5 to 10 min to complete. this is a disaster.and sometimes the browser runs out of memory. I load every thing with asset bundles and the build size is some thing like 19MB.
     
  11. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    We are seeing vast variation in load times, we've put the data files on a CDN to make the download as fast as possible but we see load times that range from 26 seconds to 15 minutes. The plugin version loads in around 10 always, for comparison, and that's just loading from a standard server.
     
  12. tCubed

    tCubed

    Joined:
    Jun 3, 2017
    Posts:
    1
    Just a note from personal experience ... Our game was taking 8+ minutes to load when we checked "Development Build" and then 45sec to 1.5min to load when we unchecked it. MUCH MORE REASONABLE. Hope it helps.
     
  13. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Development builds allow you to build a bit faster than release builds because the build files are not minified and compressed, hence it should only used for development :)
     
  14. AdhikS

    AdhikS

    Joined:
    Dec 5, 2016
    Posts:
    5
    I am facing the same issue.Empty scene is taking more than 10 sec to load.Even if the progress bar is full,empty scene takes atleast 5 sec to load the scene.
     
  15. QueenLegit

    QueenLegit

    Joined:
    Jun 10, 2020
    Posts:
    5
    @Marco-Trivellato , I'm sorry to bother you but I need your help on this.

    I've hosted my unity webgl game on my website but i get extra slow loading time on the progress bar when i try to access it with any device. It takes like 15 -25 minutes. What could be the possible cause? It doesn't act like this when I use a local xampp server.