Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

WebGL projects not loading after IOS13 update

Discussion in 'WebGL' started by SN_K, Sep 27, 2019.

  1. SN_K

    SN_K

    Joined:
    Aug 29, 2019
    Posts:
    4
    Hey everyone,

    First time poster here. We have been experiencing some issues with our webgl projects after updating to IOS13. The projects show the unity loading bar, but freezes during the last bit of the loading and remains stuck. On IOS12 it worked perfectly fine in both safari and react-native webviews. However after IOS13 it simply won't load in neither.

    We have tried almost everything to figure out whats been causing it, but no luck so far. We are running latest 2019.2.6f1 build.

    Much appreciated!
     
  2. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    Apple broke webassembly for large webassembly modules on iOS 13.0 and 13.1. I reported it and they've implemented a fix already (https://bugs.webkit.org/show_bug.cgi?id=200807). My hope is 13.2 (or whatever the next iOS version contains the fix...the Safari Technical Preview 92 on desktop already contains it, so there should be some optimism).
     
    jukka_j and De-Panther like this.
  3. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    234
    Yes, this is a disaster but sort of par for course. That's why I always build an asm.js side by side and hard code only tested iOS platforms for WASM.
     
  4. SN_K

    SN_K

    Joined:
    Aug 29, 2019
    Posts:
    4
    Thanks for the info. Will wait for the fix then
     
  5. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    78
    Thanks for linking to that URL kognito1, very good to be aware of this issue. There is unfortunately no way to measure how large a loaded up .wasm file will become in memory (it is hidden browser impl detail). It may be possible that attempting aggressive package and code stripping in a project may be enough to optimize out a necessary amount of code to keep it within that limit.
     
  6. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    For those that want to play along at home: https://trac.webkit.org/browser/webkit/?order=date&desc=1#tags/

    Any 608.2.x based webkit browser (Safari on iOS 13.0-13.1.1) will be broken. Any 608.3.x based webkit browser (Safari Technical Preview 92) has the short term fix (the fix referenced in the bug report above). Any 609.x based webkit browser has the long term fix (webassembly interpreter).

    While we are obviously all anxious for the short term fix, I'm actually pretty excited for the long term fix. That should help out a lot with memory for webassembly. :D
     
  7. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    I can confirm iOS 13.2 beta resolves the issue!!!
     
    wetcircuit likes this.
  8. russellpeake

    russellpeake

    Joined:
    Sep 14, 2018
    Posts:
    1
    Unfortunately in our case it has shown to be partially resolved. it can work, but it can also fail in the same way as well. hopefully the long term fix is implemented into ios 13.2 before the release.
     
  9. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    If you're refreshing the page over and over (and maybe even just once) you will receive the error (same thing happens in 12.x). Safari does not release/garbage collect compiled code on refresh. 13.2 has been stable for us in initial testing (or at least as stable as 12.x).

    One thing to note is the short term fix is not a robust solution. It requires the webassembly binary to be at least 10MB (uncompressed...so after gzip/brotli decompression) in size for the old safari wasm compiler to "kick in". So if your binary is like 9MB, my bet is it would still crash on 13.2 (try adding and referencing useless modules :p).
     
  10. CherryEngine

    CherryEngine

    Joined:
    Sep 10, 2015
    Posts:
    13
    After a long investigation, I've solved it. So iOS 13 is still working with asm.js
    So the workaround is to change in ProjectSettings.asset:
    webGLLinkerTarget: 1 to webGLLinkerTarget: 0

    0 => asm.js
    1 => wasm (default)
    2 => asm.js + wasm

    also worth to change
    webGLMemorySize: 16 -> in my case webGLMemorySize: 128
    But you need to try what works best for you.
    Sure because it is not wasm but asm.js - it will work slower on older iPhones and Android phones. But so far, I think it is the only solution for Unity 2019.2
     
    Last edited: Oct 11, 2019
  11. SN_K

    SN_K

    Joined:
    Aug 29, 2019
    Posts:
    4
    Thanks for all the solutions guys. We have tried the 13.2 beta and have noticed a substantial increase in loading times on our devices (some projects up to 5x), which is crazy. I guess we'll have to wait for the long-term solution and see how that goes. On android everything works as usual.

    It also makes us reconsider this approach from a business point of view. Its a nightmare to think you'd have to tell your users not to update because it would render key features of your app useless.

    Still very hyped about the potential and where it will take us, but clearly we are still far away of stable use of these type of web(view) features.
     
  12. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    316
    Have you tried outside a webview (we don't use webviews so I can't comment on any regressions there)? I find this a bit odd as the workaround in 13.2 is literally "if iOS and large wasm binary, use the old wasm compiler that was used in 12.x". It should be more or less the exact same behavior as 12.x. We have noticed no such loading regressions for 13.2.
     
  13. SN_K

    SN_K

    Joined:
    Aug 29, 2019
    Posts:
    4
    How would you recommend approaching this outside a webview. We are developing in React Native, the only logical course was the webview. We have done multiple tests and somehow the loading time has increased. On our android devices the loading time is still the same, so the difference between the two are very apparent now (IOS taking much longer to load than the Android devices, which used to be around the same).

    We haven't really been able to explain either, but it definitely is an IOS 13.2 beta issue. We will definitely conduct some more tests and see if we can somehow revert on of our test-devices back to IOS 12 and do side by side comparison.

    Appreciate the reply Kognito
     
  14. d_grass

    d_grass

    Joined:
    Mar 6, 2018
    Posts:
    13
    Hi together,
    Are there any news?
    We are also on the business point of view.
    We also told our clients that they should not update from 12.x to 13.x . But thats not a solution.

    In addition https://beta.unity3d.com/jonas/AngryBots/ is working on 13.x .
    I know it is older.
    But this application uses far more memory than ours.
    Can not be something changed today in Unity so that it works again like in the demo or will be more tolerant towards aggresive Ram Management from Apple.
     
    Last edited: Nov 6, 2019
  15. nbkhanhdhgd

    nbkhanhdhgd

    Joined:
    Apr 19, 2016
    Posts:
    12
    Hi @d_grass
    As you said "We also told our clients that they should not update from 12.x to 13.x" => It not a solution because I think that clients will always use the last version.
    Have you tried iOS version 13.2?
     
  16. d_grass

    d_grass

    Joined:
    Mar 6, 2018
    Posts:
    13
    @nbkhanhdhgd

    Yes we tried 13.2 and it is not working.
    On 12.2 it is working fine.