Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

WebGL for Mobile Devices

Discussion in 'Unity 5 Pre-order Beta' started by Garreler_Matjes, Jan 14, 2015.

  1. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Hi Community,

    does anybody know when it will possible to export WebGL with Unity5.0 for Mobile Devices like e.g. in CopperCube? A customer asks for it and unfortunately we have to constantly deny him again and again.

    Thanks,
    Matthias
     
    Yerbol05 likes this.
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's not supported for Unity 5.0. Mobile support for WebGL isn't really advanced enough yet.

    --Eric
     
  3. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
    It's strange, is WebGL Browser, or Unity use something extra?
     
  4. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    So it is in development now?
    When do the UnityCommunity get profit of it?
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    There's nothing special that needs to be done from Unity side. Problem is, mobile browsers at this point of time aren't really ready for WebGL games. Sure, you might get a simple scene running with a spinning cube, but anything more advanced will make your run out of memory in no time. Remember, you're executing your game in JavaScript, rather than native code, and that considerably increases hardware requirements. That's why we're saying it's not officially supported at this point in time.
     
  6. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    That's definitly wrong! You are able to get quite good VR solutions in WebGL from other Authoring Tools than Unity3D. Even the low cost Tool "Coppercube" is able to do so! But Unity3D is awesome (inclusive a very good community) and we don't want to change because of the not running WebGL export.
     
    MFKJ likes this.
  7. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    There are probably engines out there which handle the use case of WebGL on mobiles better then Unity does right now, by simply being more lightweight then we are, and less demanding in terms of memory and raw performance (and also more limiting). That said, I am certain that it will only be a matter of time until Unity WebGL on mobile becomes feasible, as hardware gets faster. As written before, other then a warning in JS (which you can easily disable), there is nothing preventing you from trying on mobiles now. Simple stuff should work, but it is usually pretty quick that you will reach the limits of the device.
     
  8. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Hi Jonas,

    yes I understand. But why isn't running WebGL at all on Mobile Devices exported from Unity3D?
    We just would like to explore a technical device (little more than a cube).
    It should run on a LMS,without any plugin and not as an app (so WebGL is the only option).
     
  9. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    We don't do anything to stop it from running. What is the error you are seeing?
     
  10. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    [JavaScript-Anwendung]
    --------------------------------
    Please note that Unity WebGL is not
    currently supported on mobiles. Press Ok if
    you wish to continue anyways

    Abbrechen OK



    My mobile: Samsung Galaxy S5
    So anybody has done something ...
    We not at least (I hope so ;-)
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    "Press Ok if you wish to continue anyways." - did you try pressing ok and then continue playing the game?
     
  12. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Yes, we did --- crashed in Firefox App on the mobile.
    Abbrechen (Abort) loads the player and chrashes afterwards.

    Using the default Chrome Browser the WebGL is starting and does nothing.
     
    Last edited: Jan 21, 2015
  13. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Well, if your browser crashes, then that is an issue with your browser :)

    In practice, the most likely issue you will face on mobile is the browser running out of memory. You can try building with a lower memory size in WebGL Player Settings. Also, Try building with the latest 5.0b19, and not with 5.0b9.
     
  14. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
  15. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    b18 should be fine. you can also take the "last release with minimal testing", which is at b20 now. In either case, b9 is very outdated by now, so you should update to one of those.
     
  16. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Hi Jonas,

    below you find a CubeTestProject.zip where a little scene with a rotating cube is inside.
    The Project was made new with b20.
    Maybe you look inside and give a hint which export settings are wrong.
    The WebGL Export does not work on my Samsung Galaxy s5.

    BTW: Why is a WebGL demo of a rotating cube such big (30 MB)?
     

    Attached Files:

  17. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    It works fine on my iPhone 5s. But, as I said before, the biggest issue on mobiles is memory constraints, so you should try decreasing the memory allocation in the WebGL player settings to be less then the default 256 MB.

    Read the the Unity 5.0 documentation, it has a section on WebGL build size. If your web server is properly configured, it will only serve the files in the "Compressed" folder, which are only 5.5 MB for your project - and if you enable stripping that number goes down a little more.
     
  18. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Danke Jonas,

    einmal in deutsch ;-)
    Werde dann in englisch weiterschreiben, damit alle es lesen können.

    Viele Grüße aus Bremen,
    lg Matthias
     
  19. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Sorry, but I have decreased the 256 to 128 and it did not work on Samsung Galaxy 5S and also not on iPhone.
    Would you please send an Internet URL where you have published the WebGL out of my Project I sent you?
    And would you please send me back the project with the right settings?

    Thank you. You are very pleased!

    That was really good ;-) I have deleted the Data Folder and the WebGL ran. So the compressed folder was used. Very good issue because of the package width.
     
  20. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    I did not change anything at all, i just built your attached project (non-development build), and loaded it on my iPhone 5s. That said, earlier iPhones might not be able to load it. IIRC, my previous iPhone 4 would crash if I set the WebGL memory size to more 64MB (which is really not enough to do anything more then a spinning cube).
     
  21. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    May you give me the Internet URL where you have published the Test WebGL?
     
  22. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    I've ran Unity WebGL projects on iPhone5S and iPad 2 by changing the memory size. Maybe your web host settings are wrong so it does not serve all the required file types?
     
  23. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Oh, nice hint. The memory size I have changed allready to 128. Which web host settings could be wrong in your opinion?
     
  24. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
  25. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
  26. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Yeah then it's probably just that the normal version does not support everything properly that Unity WebGL does or the version has bugs that were fixed in beta.
     
  27. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
    If Unity WebGL work in mobile device, anyone could make a list of mobile device that support WebGL Unity?
     
  28. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    That is probably not possible to do in a simple supported/not-supported fashion. What is important is how much memory you can allocate and how well WebGL will be supported (ie, which WebGL extensions, etc). And performance. That determines what kind of content you can run, but it won't be a simple yes/no question. And it will also not only be a matter of which devices you try on, but which combination of device/OS/browser.
     
  29. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Hi Jonas!

    Unfortunately, the exported WebGL by us does not work on any iOS platform and the Androids only in the Chrome beta.
    We are wondering that it is run running on your iPhone 5s as we even have tested an iPhone 6.

    Would you please send us a tested web link with the rotating cube?

    The whole thing is incomprehensible to us.
    A ZIP version of the project we would like to have where we can see the settings again.

    Regards, Matthias
     
  30. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    Very good idea Onsterion.
    Sure WebGL from Unity is in beta, but basically it should work without such an enormous effort, right?
     
  31. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    No. As was written in the beginning of the thread, Unity WebGL is *not* supported on mobiles. It may happen to work anyways on some configurations, as we don't do anything other then a warning alert to stop you from trying. But it is not a use case we currently support, or expect to support in the near future given the state of mobile technology right now.
     
    theANMATOR2b likes this.
  32. Garreler_Matjes

    Garreler_Matjes

    Joined:
    Nov 12, 2012
    Posts:
    25
    And the tested web link?
    May we get this at least?
     
  33. RalphH

    RalphH

    Administrator

    Joined:
    Dec 22, 2011
    Posts:
    592
    Matthias,

    As said, webgl on mobiles is not a use case we'll be supporting, nor really able to support at this point in time. As mobile platforms, webgl and javascript evolves, feasibility will increase and we might change this. For 5.0 that is not the case and support is as far as you can get it to work yourself.

    However, to show you what Jonas is talking about, here's a link;
    http://tinyurl.com/mh7tkx7

    As I'm hosting this from dropbox, download time will take longer as it doesn't support the gzip compressed folder & configuration (for apache) we provide; a proper setup hosting solution will do so.

    And here are the important settings;

    The build window:
    buildsettings.png

    Player settings:
    Stripping.png

    WebGL player settings
    Memory.png
     
  34. mmilne

    mmilne

    Joined:
    Sep 13, 2014
    Posts:
    59
    I can understand Matthias's frustration. Its hard to propose a website for a client that only works in desktop, especially these days when people browse on mobile devices more than desktop. Suggesting a separate iOS and Android app would more than double the cost. At this stage it pretty much rules out webGL websites as a viable option for clients. However, this isn't Unity's fault. Its the fault of the devices. iPhones could only run webGL since October last year and it is still very buggy. I have tried three.js and babylon.js. They will all crash the iPhone browser once you get to a certain poly count. Getting animation to work on mobile is nearly impossible. We can only hope that mobiles become powerful enough to handle webGL better
     
    MFKJ likes this.
  35. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    This is true, and as I said before, I believe it is only a matter of time until it will become feasible. That said, there is also an obvious conflict in place here, when you want web pages to uniformly run on any device while at the same time trying to bring high-end gaming technologies to the web, where many devices simply don't have the power to do it. I think navigating this will always take quite a lot of extra effort on the side of content providers by making the content scale well to different client devices (which may include different deployment methods for different clients). That said, it is our job at Unity to do what we can to make this as easy as we possibly can.
     
    leveelunitydev and theANMATOR2b like this.