Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question WebGL build "linking build.js (wasm)" takes forever

Discussion in 'Editor & General Support' started by doodler345, Jul 28, 2022.

  1. frozepk

    frozepk

    Joined:
    Mar 29, 2020
    Posts:
    3
    having the same issue after updated my engine to 2023.1.1f1
     
  2. sandstedt

    sandstedt

    Joined:
    May 24, 2015
    Posts:
    67
    @JustBeanUnity Just tried it on a brand new computer (also Intel), and worked like a charm.

    While doing a headless build on my AMD gaming laptop, I was following the log, and it seems to get stuck in the bee_backend.exe step for a very long time. I'll attach the the end part of the log file below, where it was in a phase where nothing happend and I just kept waiting for it to be completed.

    The build time continues to fluctuate on my AMD gaming laptop. On this build it "just" took around 20min (compared to 3min consistently on my other computers). Sometimes it's 45min. (for production builds)

    Code (CSharp):
    1.  
    2. ***Player size statistics***
    3. Level 0 'Assets/Start/Start.unity' uses 1.5 MB compressed / 9.2 MB uncompressed.
    4. Total compressed size 1.5 MB. Total uncompressed size 9.2 MB.
    5. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\bee_backend.exe --dont-print-to-structured-log --ipc --dagfile="Library/Bee/Playereaf5b70a.dag" --profile="Library/Bee/backend1.traceevents" Player
    6. WorkingDir: C:/Users/jonas/Spel/ProjectName
    7. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\Tools\netcorerun\netcorerun.exe "C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\WebGLPlayerBuildProgram.exe" "C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/PlaybackEngines/WebGLSupport/Bee;C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/Tools/BuildPipeline" "Library/Bee/Playereaf5b70a.dag.json" "Library/Bee/Playereaf5b70a-inputdata.json" "Library\Bee\buildprogram0.traceevents"
    8. WorkingDir: C:/Users/jonas/Spel/ProjectName
    9. ExitCode: 4 Duration: 0s98ms
    10. DisplayProgressbar: Incremental Player Build
    11. ExitCode: 0 Duration: 1s908ms
    12. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\bee_backend.exe --dont-print-to-structured-log --ipc --dagfile="Library/Bee/Playereaf5b70a.dag" --dagfilejson="Library\Bee\Playereaf5b70a.dag.json" --profile="Library/Bee/backend2.traceevents" Player
    13. WorkingDir: C:/Users/jonas/Spel/ProjectName
    14. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\Tools\netcorerun\netcorerun.exe "C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\WebGLPlayerBuildProgram.exe" "C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/PlaybackEngines/WebGLSupport/Bee;C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/Tools/BuildPipeline" "Library/Bee/Playereaf5b70a.dag.json" "Library/Bee/Playereaf5b70a-inputdata.json" "Library\Bee\buildprogram1.traceevents"
    15. WorkingDir: C:/Users/jonas/Spel/ProjectName
    16. ExitCode: 4 Duration: 14s
    17. ExitCode: 0 Duration: 0s763ms
    18. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\bee_backend.exe --dont-print-to-structured-log --ipc --dagfile="Library/Bee/Playereaf5b70a.dag" --dagfilejson="Library\Bee\Playereaf5b70a.dag.json" --profile="Library/Bee/backend3.traceevents" Player
    19. WorkingDir: C:/Users/jonas/Spel/ProjectName
    After that phase (wish took 14min 55s according to the log)

    Code (CSharp):
    1. ExitCode: 0 Duration: 14m:55s
    2. [websockify wrapper] Start node and websockify.js
    3. Refreshing native plugins compatible for Editor in 21.31 ms, found 3 plugins.
    4. Preloading 0 native plugins for Editor in 0.00 ms.

    And then a build report after that (didn't wanna post the entire log here)
     
    KamilCSPS likes this.
  3. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    431
    @sandstedt , do you mind submitting a bug report with your findings to Unity and posting the link here for us to follow?

    Looks like you're the only one doing comparative testing & at worst, QA will give you a ticket# we can follow if it's a duplicate with an existing internal ticket.

    Thanks!
     
  4. se210

    se210

    Joined:
    Jan 19, 2016
    Posts:
    3
    I'm having the same issue on Unity 2022.3.2.f1 <Metal> version when building with the Code Optimization: Runtime Speed setting for a WebGL build.
     
  5. duckSPLASH

    duckSPLASH

    Joined:
    Jul 11, 2020
    Posts:
    14
    Not fixed as of 2022.3.4 :(
    I'll try the workaround.
     
  6. atomikm

    atomikm

    Joined:
    Feb 8, 2020
    Posts:
    20
    We're having the same issue on 2022.3.3f1

    WebGL build takes over an hour when it used to take a few minutes.
    Set to "Runtime Speed"
    Macbook Pro 2021
     
    Skyblade likes this.
  7. PcGameHunter

    PcGameHunter

    Joined:
    Sep 16, 2019
    Posts:
    3
    Not fixed or even acknowledged as known in 2022.3.5f1
     
    Skyblade and ughost123 like this.
  8. ughost123

    ughost123

    Joined:
    Feb 15, 2019
    Posts:
    2
    We're having the same issue on 2022.3.4f1
     
    Skyblade likes this.
  9. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    226
    Same problem here. Currently using 2022.2.15 and waiting for confirmation before upgrading to LTS.
    Our project's using Inputsystem and Addressables packages. Build timer over 1 hour were confirmed on a Threadripper 3970x, Intel 12700k and github actions build workflow using ubuntu. All systems having build times from 1 - 3 hours. Using "shorter build time" instead of "runtime speed" as code optimisation drops a hot build down to 2 minutes on the TR and 23 Minutes on the github action.
     
  10. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    226
    I noticed the "Linking" step utilizes two executables, wasm-ld.exe and wasm-opt.exe. In all Code Optimisation settings, the first one seems single-threaded while the second one is multithreaded.

    In "shorter build time", wasm-opt.exe starts after roundabout 2 minutes while in "runtime speed" this executable is still not active after 15 minutes, only wasm-lt.exe takes up 100% of one core.

    RuntimeSpeed.PNG ShorterBuildTime.PNG
     
    Last edited: Jul 19, 2023
  11. TomMcEachan

    TomMcEachan

    Joined:
    Oct 29, 2022
    Posts:
    1
    Can't believe this is still an issue. Experiencing this on a brand new empty project.
     
    Greenhapi likes this.
  12. rusyaka

    rusyaka

    Joined:
    Feb 10, 2020
    Posts:
    2
    Same problem in version 2022.3.5f1
     

    Attached Files:

    Last edited: Jul 20, 2023
    Skyblade and tantx like this.
  13. tantx

    tantx

    Joined:
    Jul 5, 2017
    Posts:
    22
    Set the [code optimization = Shorter Build Time] could handle the speed problem on project.
     
  14. dinkelstefan

    dinkelstefan

    Joined:
    Mar 13, 2019
    Posts:
    30
    Skyblade likes this.
  15. Qwerty526613

    Qwerty526613

    Joined:
    Nov 26, 2016
    Posts:
    1
    I have the same problem on Unity 2022.3.3f1c1, i changed some code use JetBrains Rider(2023.1.2). then i build WebGL program, the problem was happend. but when i close Rider the problem has gone。so i think when i bulid the scene rider is load some data in scene , it has locked scene. Unity is wait for rider.
     
  16. PcGameHunter

    PcGameHunter

    Joined:
    Sep 16, 2019
    Posts:
    3
    Continues to be an issue on 2022.3.6f1
     
  17. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    Indeed says 2023.1.0b... and here i am 2023.1.8f and .. well its been >13 mins now.. it only makes a 44k build file, an how btw do you "link" a js file - its text interpreted later.. does this file even vary with project?

    Future liz was here: >25 mins to build 20+ mins were linking build.js
     
    Last edited: Aug 11, 2023
  18. arjuniscool0204

    arjuniscool0204

    Joined:
    May 16, 2017
    Posts:
    14
    @JustBeanUnity any update on the multi threading issue with the build modes?
     
  19. igamebank

    igamebank

    Joined:
    Jun 25, 2019
    Posts:
    1
    When I disable "Name Files as Hashes" it seems to compile very quickly (Unity 2023.2.0b4) . Anybody else, or is this a wild fluke?

    Update, it was a fluke. It worked once and hasn't since.
     
    Last edited: Aug 11, 2023
  20. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    shame
     
  21. Epiroc_RS

    Epiroc_RS

    Joined:
    Jan 10, 2022
    Posts:
    3
    How is this not only not fixed yet, but basically ignored ???
     
  22. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    ive got a site with a bunch of unity games on, compiled up a 2d one today stuck it on.. and yet again its not loading properly - Im getting sick of the way unitys web has to be "just so" or it falls in a heap of poop .. i dont want to have to recompile all the old projects in new unitys just to make sure all websettings are the same.. if itends in .gz its gziped it shouldnt need special settings
     
  23. AmmarByFar

    AmmarByFar

    Joined:
    Nov 20, 2019
    Posts:
    4
    I guess the question is, how much does the "Runtime Speed" actually help during runtime? Is there a noticeable framerate increase? Much faster loading times? Where does the performance in Runtime actually come in?

    If it's not too noticeable I guess, I'll just stick with "Shorter Build Speed" to keep things moving along.
     
  24. tkgix

    tkgix

    Joined:
    Nov 9, 2016
    Posts:
    5
    2022.3.3f1, the same problem is occurring.

    Why does Unity get worse with every update...?
     
  25. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    349
    This has been explained numerous times, in this thread (on a different page) and other threads. Please read through the threads to see if there is a solution before replying the same thing everyone else is.

    Why the build is slow: https://forum.unity.com/threads/how...sm-time-be-accellerated.1427124/#post-9260838

    How to make build faster: https://forum.unity.com/threads/how...sm-time-be-accellerated.1427124/#post-9261150
     
  26. edassis

    edassis

    Joined:
    Jul 15, 2022
    Posts:
    4
    I recently migrate my project from 2021.3.8f to 2022.3.9f1 and build.js is taking forever to link:

    upload_2023-10-1_14-7-3.png
    This time passes 30 minutes.

    I removed Library/. Temp/, Obj/, Build/ and made a clean build.

    Time to rollback to 2021.* I guess.

    ---

    EDIT1: I just saw jukka_j's answer and I can confirm that changing Code Optimization to "Build Times" indeed made the build process much faster (< 7 min). "WebAssembly.Table" and "BigInt" language features is available from version 2023 onwards.
     
    Last edited: Oct 1, 2023
  27. Pawl

    Pawl

    Joined:
    Jun 23, 2013
    Posts:
    113
    +1 My build times for a small 2D game:

    Unity 2021.3.16f1 were ~3 minutes
    Unity 2022.3.10f1 are now ~12 minutes.

    Screenshot 2023-10-09 231135.png

    Shorter Build Time (as advertised, I guess) brought them down to ~4 minutes.
     
  28. vbl-public

    vbl-public

    Joined:
    Feb 16, 2022
    Posts:
    4
    Having this issue now, builds were taking ~10 minutes on 2021.3.10f1, now taking hours on 2022.3.10f1 (I don't have hours so I haven't been able to let one finish). This is insane that Unity shipped 2022.3 LTS in this condition!?
     
  29. unity_4129B0F0E28458052E80

    unity_4129B0F0E28458052E80

    Joined:
    Oct 16, 2023
    Posts:
    1
  30. jackcrosa

    jackcrosa

    Joined:
    Oct 16, 2012
    Posts:
    22
    My project also takes an hour to build this is very bad.
     
  31. Skaldhiir

    Skaldhiir

    Joined:
    Oct 21, 2013
    Posts:
    2
    Same issue with Unity 2023.1.15f1
     
  32. kenor_brooks

    kenor_brooks

    Joined:
    Jun 4, 2020
    Posts:
    46
    2022.3.12f1 same problem.
     
  33. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    431
    For everyone posting "same issue", it is per-design and Unity won't "fix it" per se.

    The compile options posted in this thread are exposed in 2023.x to make it easier to use. Otherwise, I hope Unity Mods can just close this thread as it is noise.
     
  34. Eloren

    Eloren

    Joined:
    Jul 17, 2019
    Posts:
    23
    The build time is longer AND the build size is larger, it's insane
     
  35. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    once you do the first compile - (of the day it feels) it does incrementals, which are faster, but it doesnt seem to notice that the previous version was yesterday and the only thing that changed is you had a nap in between

    where as for example gcc and make skip through and while it does the traditional .c/.cpp -> o -> binary options, unity does seem to do something simialr, so, why cant it do the if o is newer trhan .c/.cpp then it hasnt changed ... skip... logic and save us all beginning to be noticable parts of our lifetime.. soon people will be quoting that as part of game dev if you spent say 3 years of dev a game, 6 months was waiting for the compiles. Big games take long enough anyway, fortunately webgl games arent likely to be that big, but at 20 mins+ for a full build and its going to do that more times than not...
     
    Last edited: Nov 4, 2023
  36. N1Joke

    N1Joke

    Joined:
    Feb 24, 2021
    Posts:
    1
    Unity 2022.3.10 same issure
    upload_2023-11-9_1-58-48.png
     
  37. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    648
    So ... what exactly is the status of WebGL going forward for Unity? Its the _only_ reason I'm currently using Unity over UE5. Is webgl basically dieing over here, or is this just another one of those "Unity's spending $$$ on stuff that no one needs but won't fix their actual engine" bugs (I mean features), like the shadow glitch with alpha clipping in URP which forced me to regress to 2021?

    I have a project which I made in URP 2023. Shadow glitch ... tries 2022 ... shadow glitch also on build ... 2021 worked ... so fine. Try to do webgl ... discover that URP in WebGL had a bug and wouldn't build. Port over to standard, works in standard 2021. Upgraded to standard 2022, and webgl now takes forever. Probably will regress again to standard 2021.

    Wow am I super un-impressed right now.
     
  38. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    i regressed back to builtin after constantly trying to fix light leaking through what amount to 50cm walls under urp. It looked fine in the editor (yes same quality etc settings) but once built it was a s**t show
     
  39. Greenhapi

    Greenhapi

    Joined:
    Jun 22, 2020
    Posts:
    3
    This is still a problem.
    Unity 2023.3.0b3 DX11, Windows 23H2 (build 22631.3007)
    The building process was stuck for 20 minutes, so I aborted it.
    The project builds in about 30 seconds on Unity LTS 2022.3.16f1

    2024-01-17_13-52-24.png
     
  40. Greenhapi

    Greenhapi

    Joined:
    Jun 22, 2020
    Posts:
    3
    Stable Unity 2023.2.5f1 has the same problem. Then it proceeded to "brotli" something and died. webgl_unity.png upload_2024-1-17_14-49-25.png
     
  41. sandstedt

    sandstedt

    Joined:
    May 24, 2015
    Posts:
    67
    Tested PlayCanvas for web-games. Such a breath of fresh air. Sure, Unity Editor is better. But having zero-compilation and iteration time is lovely. Havn't build that large of a game yet though, so can't say for sure.

    Wish Project Tiny was still a thing.
     
    amateurd and Greenhapi like this.
  42. amateurd

    amateurd

    Joined:
    Nov 1, 2016
    Posts:
    97
    Agree PlayCanvas is a lot less clunky. It's so cool to be able to make a minor change and see the results in a second or two rather than waiting for Unity+IL2CPP+WebGL to tie itself in knots for 7 minutes before you get a realistic preview of any change. Unfortunately, the learning curve is steep and it can be hard to translate what you know with years of Unity into how to do things with PlayCanvas instead.
     
    Greenhapi likes this.
  43. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    90
    Sometimes it builds it in 94 seconds, sometimes in 20 minutes, that's not good
     
  44. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    1,450
    well i got a new machine today, a 14900KF (32 logical processors) with 64gb memory and a 4090 card and a fast hard disk so imagine how narked i felt when i build my 5 scene project with 4 of the scenes are 2 with a bit of text (and 2 of them barely a sentence)
     
  45. AndreaGalet

    AndreaGalet

    Joined:
    May 21, 2020
    Posts:
    90
    Welcome to the jungle
     
    xucian likes this.
  46. Ololo1q2w3e4r

    Ololo1q2w3e4r

    Joined:
    Mar 22, 2021
    Posts:
    1
    Ребят, просто Поставьте "shorter build time" в build settings
     
  47. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    803
    For whoever comes here from google, basically what this guy says.
    Only switch to the other option when you're releasing the build. Maybe have a custom script to do so
     
    Last edited: Feb 28, 2024 at 11:32 AM
  48. Atomiz2002

    Atomiz2002

    Joined:
    Feb 2, 2020
    Posts:
    14
    Its UNREAL that this issue persists for that many years with no adequate solution. There is no WAY anyone from the unity dev team is this decelerated up there to figure it out and push out a proper solution. @AlwaysCraven Quit adding things before the existing ones work correctly.
     
    xucian and amateurd like this.