Building times are still crazy long, that’s not really fun, even for a small application like that one.
Stripping out unity features you don’t want is now pretty easy with 2018.2.
With TMP and Physics included the application has about 3MB size, with Gzip I had around 4MB.
Loading times for this simple application are quite good on PC.
Experience on mobile is nowhere near you can get with other frameworks like three.js
Especially the last point makes building WebGL applications with Unity quite uninteresting for me. I’m wondering where the problems are and what the roadmap is for WebGL for supporting mobile. I got this message that it is not supported, the application still worked, but loading the scene (at least that’s my guess since the progress bar halted at 90%) took more than 10 seconds.
TL;DR: Is unity focussing on WebGL for mobile and if so is there a roadmap?
I think Unity is hesitant to officially support mobile WebGL until the builds work on iOS. The problems with iOS are numerous.
Only support for WebGL 1.0
Incredibly small ram sizes on iPhones
Even smaller memory available for browser applications
Lots of memory issues with webassembly
Unity builds work great on old mid- to high-end Android phones, but are horrible on iOS.
What Unity could do is support native device texture compression on download like PlayCanvas. That would help keep the download size and ram usage much smaller.
Hm, that makes sense. The test I did was on an iPhone SE, so maybe the experience is better on android (I won’t remove the test from my website, so feel free to test on android as well). @svaa1982 : It does work, but it was a bad experience, not sure about future plans though.
What build and settings did you use to get this working? I can successfully launch your test using my iPhone X with good results, but I am unable to build my own project and get it to run (2018.2 or 2018.3 beta). I can get builds to run on Android without issue. I can’t get Unity’s own benchmark project to run either (which they claim can be run on mobile) Unity WebGL Player | Benchmarks
To be fair we haven’t tested it much on mobile. We have seen reports from users that there is an issue that prevents Unity WebGL content to run on iOS but we haven’t investigate yet.
Nothing special actually… I will upload the project to github, so you can have a look. iOS only supports WebGL 1.0 as far as I know.
As I learnt, the project I uploaded can be further optimized, if the server is configured correctly. I didn’t define any file types to be transmitted with brotli compression, so the project could probably load quite a bit faster. I guess it is still not realy feasible for mobile though.
Hi Marco! I’m worndering, how are the plans for mobile webgl builds? And where is the priority right now? Is it optimizing build times, or better compression techniques or supporting more hardware/platforms?
At the moment we are focusing on improving the runtime, not specifically with mobile in mind, however as we improve the experience on desktop browsers, it will also improve on mobile.
It would be nice to speed up build times as well but it’s not something we are looking at right now.
@Johannski what are the build settings for your test project? It runs very well on my iPhone SE.
When I build anything myself (eg. a nearly empty project), the app always crashes at startup with “Error: Out of executable memory”. Same with the unity benchmark, as @JRock24x mentioned. Have you encountered this issue before?
I tried a very similar test but as soon as I add any scripting in to control the camera the engine code doubles in size and then fails to load on an iPad Pro using Safari, it never makes it past the loading screen. Unity 2018.2.14
Did a new test with Unity 2019.3.0f6. iOS still gets the annoying warning, but still works. Loading time on iOS is still pretty long and the file size increased a bit comparing to 2018.2, but there are less files and wasm streaming is supported.
I guess it is still not a focus for Unity, and iOS still only supports WebGL 1, but for desktop they have made improvements. I was quite surprised, that I didn’t have any problems with building my last gamejam game (using Unity 2019.3 and URP) for WebGL: MORTAR MORTAR by LuBu, ArtemFritzsch, Johannes Deml
So as of now: Using Unity for Desktop is agood choice, if you want to support mobile (especially iOS), it’s goindg to be hard.
Could be a bit more elaborate to change the whole function, but this did the necessary trick. Any other improvements in there compared to the minimal html version?
Thanks for sharing @Johannski indeed I found your approach curious as I share the same one with @CsUtil (and documentation) where you just write a custom template that sets any conditions you wish in compatibilityCheck and reuse across projects (also suggested by @Marco-Trivellato in another thread ). I understand you might prefer doing it in post build, I need to restyle default Unity template anyway…
Can also confirm that simple URP builds work fine on iOS devices (tested back to iphone 7) deploying from Unity 2019.3+. However, these are going to expand in the following months so will see then!