Search Unity

WebGL support SHOULD be improved on mobile

Discussion in 'Web' started by Kronnect, Mar 6, 2015.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Hi,

    I was excited to hear that Unity5 was supporting WebGL. That's a great advancement since it will allow us (theoretically) to overcome any "store" for apps, and let's our players just navigate to our website and start to play without having to install any plugin.

    I don't know why, but I understood at the time that supporting WebGL would allow us to embed our content in other webpages and browse it from mobile, which is the most used platform for browsing the web, hence consuming WebGL content.

    Unfortunately it seems that WebGL is not very debugged (at least on iOS). I'd love to read some recommendations to get projects built on WebGL running on iOS and Android, even it requires to drop some quality parameters.

    Also, I'd like to know at what point we are concerning mobile and WebGL. Is this something that requires maturity on the mobile space or it's just that WebGL support in Unity5 is still buggy? Anyone at Unity?

    Finally, I'd like to reinstate the importance to support WebGL on mobile due to the fact that most of people browse the web today on this mobile devices.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes.

    That too (it's not labeled "preview" for no reason), but even desktop browsers have some maturing to do in this area.

    --Eric
     
  3. boogsarah

    boogsarah

    Joined:
    Mar 5, 2015
    Posts:
    7
    We would second the importance of WebGL on mobile browsers. We work in the education space which is increasing using mobile devices.
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    We don't support WebGL on mobiles yet. I expect that we will eventually, but getting there for non-trivial stuff will still require some progress in performance and stability of mobile WebGL/JavaScript implementations and memory availability.
     
    gfoot and Onsterion like this.
  5. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Thanks for replying. Yes, I supposed (wrong) mobile devices were powerful enough today to support WebGL but it seems they're not (yet). Well, this is a good argument for still going native for this kind of developments!
     
  6. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    Partly it is a matter of priorities for the mobile browser vendors. They may not feel the same urgency that some of the desktop vendors are feeling at the moment, because they're generally happier for their users to download a dedicated app. This is not helped by the browser vendors being the same people that run the app stores, who earn a significant revenue share from the latter! :)
     
  7. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    It is partially a matter of mobile browsers support, but it is also a matter of hardware limitations, specifically when it comes to memory.
     
    gfoot likes this.
  8. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    That is interesting. Do you have any statistics or ballpark comparisons of Unity's memory usage on desktop, comparing the asm.js+emscripten+il2cpp stack with the standard Mono JIT environment?
     
  9. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Highly unscientific test: A simple little casual game prototype I made (2D, uses new GUI + SpriteTile) is eating 265MB in the standalone version with Unity 5 after a typical round. The WebGL build reached 665MB after a slightly shorter round.

    I think both are way too high, as my main 2D project is far more advanced, and kept under 100MB in Unity 4. I haven't looked at numbers in 5, as it's in shambles at the moment :p
     
  10. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    *Unity's* memory usage should be roughly the same in both cases.

    There is a problem however: Unity shares that memory with the browser, which may allocate it's own memory for all sorts of things. For one, this leads to less total memory being available. The bigger issue, however, is that emscripten operates by allocating one giant array of bytes (TypedArray in JS), which will then be used as the application heap. This means that the JS engine must allocate one consecutive block of memory of the required size (as specified in WebGL Player Settings). With limited overall memory space, and then the browser fragmenting some of that, it can be problematic to allocate such a block - which will cause the WebGL content to fail loading, or the browser to crash in the worst case.
     
    theANMATOR2b and gfoot like this.
  11. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Yep, the browsers already have ridiculous overhead just showing a regular webpage. WebGL is for modern devices :)