Search Unity

WebGL builds are completely unusable

Discussion in 'Web' started by Fragment1, Aug 31, 2020.

  1. Fragment1

    Fragment1

    Joined:
    Aug 30, 2013
    Posts:
    67
    I've been sitting here for 25 minutes waiting for "Building native binary with IL2CPP" to finish.
    Looking at it with process manager it's sitting at 579.1 MB of ram and no CPU, disk, or network usage.

    I previously gave up assuming it hung after asm2wasm.exe climbed above 5GB of ram and hadn't finished yet after 40 minutes of throttling my CPU at 100%

    Does anyone know if there's any priority on making this actually usable?
    Does anyone with unreal engine experience know if they do WebGL builds any faster? This is going to cripple any productivity and be a complete deal breaker for my current project.

    Edit: So I decided to go and sleep while waiting to see if this'll finish and 6 hours later the IL2CPP step is still on my screen.

    Edit 2: I have no managed to push out a build in under 10 minutes by setting the colour space back to Gamma and auto graphics API back on. Is linear colour space currently unsupported?
     
    Last edited: Aug 31, 2020
  2. Egg

    Egg

    Joined:
    Oct 8, 2012
    Posts:
    9
    I had the same issue at the step that asm2wasm processes the build. I'm using URP & Linear color space in 2020.1.3f (the issue remains in 2020.1.4f as well). Would take about 45 minutes to finish (and asm2wasm.exe ballooned to 5GB+ memory usage as well) for a small gamejam prototype.

    The workaround at the moment seem to be to go to Project Settings > Player > Publishing Settings and set Compression Format to Disabled. After switching compression off, builds took less than a minute just expected for my small project. Sometimes the issue returns and honestly it might be a antivirus problem, so check that.

    This problem exists even with a fresh project.
     
    Last edited: Sep 2, 2020
  3. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    Anyone know if this problem is solved? I can't really see the point in advertising that Unity builds for WebGL if it takes more than 10 minutes to build an empty scene.

    I can't really see how this would work in terms of development? Are you supposed to develop for PC and then switch for WebGL at the end and cross your fingers that it works?

    I've just been watching a video by Jonathan Blow where he compiles a million lines of code in less than 10 seconds. Something is going wrong somewhere.
     
    Last edited: Jan 14, 2021
  4. Egg

    Egg

    Joined:
    Oct 8, 2012
    Posts:
    9
    The issues I had with 2020.1 were mostly due to some changes with new features they added.

    I'm using 2020.2 now and the build times are much snappier as expected.
     
  5. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    Oh OK. I'm using 2019 LTS. So maybe I'll check that out.
     
  6. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Before working at Unity on WebGL, I worked at Mozilla and collaborated a lot with Unreal Engine 4 for their web builds. Their web builds back then were somewhat faster than Unity, because they do not use a scripting language (C# that Unity uses). However their build sizes to the web were bigger than with Unity (at the time). Shortly after I left Mozilla, Epic announced that they are dropping web builds from being an officially supported target, leaving it to their community to maintain. I have not observed them closely after that, but hopefully their web export is still doing well even though it is not on their official roadmap. (a lot of love towards those guys, great people there as well)

    This is the first time I hear that color space and/or built-in vs URP renderer would affect build times significantly. Does the slow build time issue deterministically occur e.g. on the URP project. For me that builds in ~5 minutes.

    There is a roadmap for 2021.2 that will remove the asm2wasm.exe from the equation altogether. We are also working on improvements to incremental C# build pipeline to improve C# to C++ compilation times. (that will benefit other platforms than WebGL as well)
     
    NotaNaN and Egg like this.
  7. Egg

    Egg

    Joined:
    Oct 8, 2012
    Posts:
    9
    On a whim, I tried out a WebGL build in 2021.1's beta with this small project I've been trying out. Didn't touch the WebGL settings at all and this was a project freshly made in 2021.1b using URP with the 2D Renderer.

    The first build took about 11 minutes, the 2nd (no script changes) took 50 seconds, and a 3rd (with minor scripting changes) took about 7 minutes. asm2wasm.exe still takes the longest portion of time and balloons up to 5GB+ of memory for some reason, so it'll be wonderful to be able to skip that step entirely~

    Decided to try out changing color space to Gamma (along with minor scripting changes again) and the build took just under 7 minutes again. So that doesn't seem to effect build time at all.

    For a 5th build, I changed color space back to Linear and the Compression Format to Disabled (from gzip). It built in only 52 seconds, which is perfect for test builds.
     
  8. Oneiros90

    Oneiros90

    Joined:
    Apr 29, 2014
    Posts:
    78
    This would be HUGE for Unity WebGL developers. Looking forward to that, thank you @jukka_j
     
    Egg likes this.
  9. tiggaxxx

    tiggaxxx

    Joined:
    Jan 13, 2020
    Posts:
    30
    I have been experiencing this as well. Recently i have updated my working computer from a 2011 MAC to a Ryzen 7 3700x Windows machine, believing that it would improve my build times.

    But all i got were new problems... The project not only takes longer times to build as it's very unstable, most of the times it gets stuck on "Stripping Assemblies" or "Building native binary with IL2CPP" and i need to terminate unity process and start over... I have already tried changing the stripping level, but didn't change much, it worked at first, but the next day the same thing happened again. If i look at the task manager i can see that the Unity process isn't using any CPU, so i assume something failed and it stopped.

    I am using Unity 2020.3.12f1, and building with Gamma Color Space and brotli compression.
     
    Last edited: Jul 6, 2021
  10. IckyToo

    IckyToo

    Joined:
    Oct 11, 2021
    Posts:
    1
    having similar problems on modtheCube build for junior programmer. Sometimes it builds, often it hangs with asm2wasm.exe hogging cpu time and memory. Using latest LTS 2020 ...