Search Unity

WebGl player loads and then nothing (local)

Discussion in 'Web' started by BazAudiogaming, May 21, 2015.

  1. BazAudiogaming

    BazAudiogaming

    Joined:
    May 13, 2015
    Posts:
    2
    Hello people!

    I'm trying to make a WebGl version of our current app to see what kind of results we can get.

    I managed to get the build going by hacking through some not-essential features (after all it's just a test) but I got an issue once the "Build & Run" is finished and firefox open the .html page :

    The WebGl player opens up, I see the pink loading bar going to 100%. And then nothing.

    I then tried to only include the loading screen of our app so that the app itself would be much lighter, but even if I wait like 5 minutes after the loading bar is at 100%, I still go nothing.

    I tried building a dummy project in Unity with a floor and a cube falling on it (couple of box collider and a rigidbody) and I indeed managed to have it working on Firefox :)

    So I guess the problem is from our app. I have not a clue what it could be. I see no error in the building process and when I open the firefox console, I see no difference in traces when I have the dummy project working and our app not working.

    Any tip/advices please?


    Best regards,
    Baz
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,702
    Did you push the build up to a web server? (Don't just double-click the HTML file on your desktop; it doesn't work this way, unlike the old web plugin builds.) I presume this is all good, since your cube test works.

    Did you wait long enough? It might take 30 seconds or more after the pink loading bar gets to 100%. One medium-size web project that I built in 5.0.1 took almost 2 minutes to start.
     
  3. BazAudiogaming

    BazAudiogaming

    Joined:
    May 13, 2015
    Posts:
    2
    Thx you TonyLi for your feedback.

    In the doc it says : "You can view your WebGL player directly in the Firefox browser by simply opening the index.html file. For safety/security reasons, most other browsers place restrictions on scripts opened from local file: URLs, so this technique will not work. If you use Unity’s Build & Run command (menu: File > Build & Run) then the file will be temporarily hosted in a local web server and opened from a localhost URL (this avoids the security restrictions)."

    Because my dummy project worked, I presume like you that this is all good to "Build & Run".

    I did wait long enough. The loading bar takes about 10 seconds to fill to 100%. Then I can wait 10 minutes, it won't do anything else. It's hard to debug because there is no trace, no log, no feedback :(

    Maybe someone else will have another idea?
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,702
    Sorry, I forgot to mention Build & Run. It's just double-clicking the HTML file that won't work.

    Have you tried the following settings (just as a test):
    • Fastest (also try Slow)
    • Development build
    • No stripping
    • Enable exceptions: full
    In a build with those settings, is there anything in the JavaScript console?

    What about different browsers, such as Chrome?
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Open your browser's developer console and see what it's writing during the loading process and at the point where it gets stuck (if it does print anything).

    You can also post that here if anything interesting shows up.

    BTW is your project very large? if so, the resulting JS and data files will be very big, making loading very slow (compression can help in that case).
     
  6. Fabzil_2

    Fabzil_2

    Joined:
    Jan 26, 2015
    Posts:
    10
    Hello!

    Thx for your feedback :)


    Yesterday I downloaded the lastest version of Unity 5 (Unity 5.0.2f1), and I tried again but it didn't work.
    I tried to make another build with the options you mentionned, and I got an error
    [Uncaught RangeError: Invalid array length]

    I failed to try with Chrome because I can't find how to configure Unity to open the .html with it instead of Firefox

    ---
    I then created an entirely new project, with just a rectangle as ground and a cube with a rigidbody : press play and the cube fall from the air unto the ground and stays there. Most basic build ever.

    I first build it with 512 available memory, but I got a "not enough memory" error. I guess it's because I build it without any optimization. I then ranked up the memory to 2048 and build it again.

    I got a [Uncaught RangeError: Invalid array length]
    with the most basic scene ever :(


    I'm not giving up but I could use some help
     
  7. DudeGuy

    DudeGuy

    Joined:
    Jul 17, 2014
    Posts:
    19
    Sounds rough. I've been through a few of these headaches myself. I would recommend trying the 5.1.0 (latest) of Unity. At this time 5.1.0f2 is the latest. They're in release candidate phase, so it could become the real deal soon. Ever since the first 5.1.0 beta came out, I've been using those for all of my development as they seem to be much more stable, and faster.

    https://unity3d.com/unity/beta

    You could also try a patch for 5.0.2 (I haven't used the patches in awhile).

    https://unity3d.com/unity/qa/patch-releases