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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Current WebGL limitations

Discussion in 'WebGL' started by topofsteel, Apr 16, 2015.

  1. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I've just begun publishing to WebGL. I see the Chrome and Firefox requirement is only with Unity's implementation. When can we expect additional browser support? And and full feature support like realtime GI and substances? One of the hurdles i've faced with the Webplayer is that it wasn't seamless, some browser's worked better than others and you needed to install the viewer. I'm looking forward to all of the pieced being in place. Thanks.
     
  2. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Actually Safari already works well at this point (with the exception of fullscreen, joystick and mouse lock support, which Safari does not have). IE works, but without Audio, which Microsoft is fixing. I hope that we will support realtime GI at some point in the course of this year, not so sure about substances.
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    It was mentioned in anothervthread, but just wanted to make sure: PlayerPrefs are not supported currently right?
     
  4. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    As I just wrote in the other thread: They should work - backed on the IndexedDB local storage.
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    whoopsy, looks like i got it wrong. What about WebPlayer? we are using the same code path for both to store key/value pairs. Maybe we should use PlayerPrefs in WebGL then.
     
  6. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    I'm glad to hear about the additional browser support. Realtime GI would be nice, and I only mentioned substances because they were mentioned in the blog as a restriction. I can easily use the exported maps. So It sounds like I can publish the WebGL content without a disclaimer (this will only work on.. ) as long as I don't use sound, full screen or mouse lock?

    Wait... Just tried my test scene on IE11, it works in the end but I get the error in the screenshot below. Then the Audio API error. Can you remove the 'Not Supported..' message. That will stop users from continuing. And actually, refreshing the page to get another look at the errors, the Audio API error does not come to the front. So I don't see the error and cannot proceed. I'll have to test safari on my wifes mac :/

    Also, I had a bear of a time getting the WebGL content to work on my Host's server. I'll start a seperate thread/bug report for that.

    IE error.png
     
  7. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Web Player also supports PlayerPrefs, but using a different mechanism, so you cannot read prefs written by the web player in webgl or vice versa.
     
  8. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    You can remove this by editing the UnityConfig.js. We will not remove it by default until we can claim "proper" support in IE (which is clearly not the case without audio).
     
  9. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Negative on Safari. I got the compatibility error and then it recommended I use Firefox. Started loading and never got there. My test project does contain mouse lock code, and the template I used provides the fullscreen option. Would having that code in my project prevent it from loading? Throw errors? or just not include those features?

    As a disclaimer, I don't know anything about my wife's mac, safari, or whether or not 72 open tabs played a part :/
     
  10. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    I have searched the docs but haven't found anything considering cache. Does WebGL support cache like Web Player did? Because my game has a lot of stuff in bundles and using Web Player my players downloaded the files only once and it was stored in their cache so they didn't have to redownload whole parts of the game every time they opened it. If that's not the case with WebGL is there some workaround for it?
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You have to actually enable WebGL first. Then it works.

    --Eric
     
  12. insmo

    insmo

    Joined:
    Apr 17, 2015
    Posts:
    12
    Browsers do cache JavaScript if you serve the files with the correct HTTP headers
     
  13. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    But that's browser cache, which is limited to 1 gb or less(out of total browser cache which includes videos, images etc. so it get's rewritten pretty fast) depending on the browser. Web Player had dedicated cache which got saved to your local storage and got loaded by request. I guess IO is not possible with WebGL and therefore there can't be dedicated cache like with the Web Player. This things should have been mentioned in the docs, and I think there should be some workaround for this.
     
  14. insmo

    insmo

    Joined:
    Apr 17, 2015
    Posts:
    12
    Yes, In that case there isn't much you can do (I think). HTML5 storage is less than this so the browser cache is most likely the biggest you can get.
     
  15. bsterling250DI

    bsterling250DI

    Joined:
    Sep 25, 2014
    Posts:
    78
    Not to mention, that PlayerPrefs get stored in the IndexedDB, which gets deleted when people Delete their cookies and other site data, where PlayerPrefs in the web player were safe if the user switched browsers, cleared their cache, or deleted cookies.

    Our company is moving all our web games that require saving to cloud storage, its the safest way to alleviate this issue and opens us up to cross platform data sharing.
     
  16. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Actually, In Safari 8, WebGL is enabled by default. In earlier versions, it is a hidden development option.
     
  17. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Yes, unlike people wrote here, AssetBundle caching using WWW.LoadFromCacheOrDownload *is* supported in WebGL (where it will be backed by IndexedDB storage). However, since, unlike the Web Player, we don't control this, it is upon the browser to decide how much storage you get, when to clear it, and whether it will ask the user for permission to store the data. Different browsers have different policies here. Also unlike the Web Player, we no longer require a special license to use this feature.
     
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I thought so, but I have Safari 7 so I wasn't completely sure.

    --Eric