Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Unity takes forever to build a Player (fix inside!)

Discussion in '2019.3 Beta' started by Peter77, Sep 7, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,591
    In Unity 2017.4, building the project attached to Case 1108597 was a matter of a few minutes.

    Starting with Unity 2019.2, building the project didn't even finish after several hours:
    https://forum.unity.com/threads/cas...-resolving-used-channels.704663/#post-4710566

    When I upgraded to 2019.3, I experienced the same problem. A build would never finish in an acceptable time frame, so I never built the entire project, but only parts of it to test certain things.

    Today I removed the Library folder from the project and let Unity reimport everything. Since then, building a Player in 2019.3 is as fast as in 2017.4 and the "Resolving used channels" step while building does not seem to occur anymore.

    If anybody experiences the same issue, I recommend to give it a try to remove the Library folder.
     
    imDanOush, sj631, andreiagmu and 3 others like this.
  2. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
    In your case, did this also fix the slow Shader Variants Compilation? (thousands of variants being compiled)

    I tried deleting my Library folder, but that fix didn't work for me. :(
    I tested on Unity 2019.3.0f6, the shader variants compilation is still too slow.

    Actually, only the first build is slow, the shader variants compilations on following builds are cached and WAY faster.
    But that first slow build is still unacceptable, its nothing like 2017.4.
     
    flintcheeze likes this.
  3. Pyxis-Belgique

    Pyxis-Belgique

    Joined:
    Jul 1, 2016
    Posts:
    14
    It was an easy trick to try, so I gave it a shot. But as I expected, it didn't offer any good results.
    I still have thousands of shader variants despite having activated the "Strip All" and try a few things.

    I don't understand why I should generate all this just for the basic scene under Universal Render Pipeline for Android.
    I don't know if it's a bug, but it's very regressive.

    The GTX Ti running at full speed... What a waste.
     
    AlterMannn and Fibonaccov like this.
  4. sj631

    sj631

    Joined:
    Dec 23, 2016
    Posts:
    22
    I am using Gaia which uses Universal Render Pipeline (URP). Unity version 2019.8 , Android build is taking too long around 1.5 hours. It keeps on doing "Mesh Data Optimization - Resolving used channels". Do you have any solution.
     
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,591
    Have you tried to disable the Optimize Mesh Data setting?

    upload_2021-3-2_18-3-35.png
     
  6. sj631

    sj631

    Joined:
    Dec 23, 2016
    Posts:
    22
    Thanks, build time is now reduced to 5 minutes
     
  7. oleg_v

    oleg_v

    Joined:
    Nov 10, 2017
    Posts:
    68
    Just want to write "Thanks!", but...
    Really "Resolving used channels" disappeared (Peter, thank you!)

    But "Compiling shader variants" seems to stuck in a loop. I see probably 6-7th times already how "Terrain/Lit" is compiled for >1000 variants. Than Unity switched to other shaders and than back again.
    I cleared Library folder, save/load only used shaders, select "Strip all" in Graphics prefs, but no.
    Almost 6 hours i can't get my windows build.
    I'm using NatureManufacture, Unity 2020.3.11f1 and URP 10.5.
    A month ago it was not a problem, when only used shaders were compiled. But i can't catch whats wrong for now except large NatureManufacture package.

    It seems i don't use any specific NM shaders, but they are appeared in "Compile shaders" again and again.
    Plz help, just want to get my build for steam.
     
  8. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    I thought I was imagining things until I read this. It does seem to loop over! I was building for 27 hours and canceled and this was NOT the initial build. Then started again and still running at hour 7. I think I am going to cancel again and try what Peter suggested.
     
  9. oleg_v

    oleg_v

    Joined:
    Nov 10, 2017
    Posts:
    68
    I have build my game multiple times since Aug. Build took up to 20 minutes, often less. But all changes were mostly in scripts.
    AFAIR I broke the shader compilation loop by deleting demo scenes from 3rd party assets. They were not included in the build but had redundant shaders noted in compilation.
     
    FlightOfOne likes this.
  10. XR-Phil

    XR-Phil

    Joined:
    Jun 13, 2019
    Posts:
    19
    I have a simmilar Problem...it compiles the shaders, now over ~198.000 and it gets slower and slower. After 1h:15min unity compiled round about 10%. Is that normal ? (2021.3.5f1 HDRP). 3 Scenes with Gaia and Nature Manifacture Assets. Most of the time it works on the Foliage folder.
     
  11. oleg_v

    oleg_v

    Joined:
    Nov 10, 2017
    Posts:
    68
    Hi!
    I have 2021.3.0, HDRP and it much more predictable build time than in URP/2020.3.
    What I have now is a ~4 hours build for the first time, with clear build steps (No infinite compilations of the same shaders/passes).
    BTW I cleared NM demo scenes (and all demo scenes from other assets).
    Note: don't forget to disable all the features you are not using in HDRP/quality settings. I don't remember exactly, but i had enabled one of the feature and build time (estimated) was about 48 hours. But I don't use this feature and disable it for next builds.

    For URP the only thing helped me is to restart the build. After several restarts it was completed much faster.
     
    XR-Phil likes this.
  12. XR-Phil

    XR-Phil

    Joined:
    Jun 13, 2019
    Posts:
    19
    Thx for the tipps...i deleted all demo scenes and checked the HDRP Settings...i give it a try.
     
  13. XR-Phil

    XR-Phil

    Joined:
    Jun 13, 2019
    Posts:
    19
    Well....As there are different "stages" of the Compiling status (GBuffer and Forward, maybe there was a third one) it goes very slowy at this "Forward" Stage...maybe 50fp all 10 seconds. This takes Hours, Forward started yesterday evening and is still not ready after 12h 40min. I i calculated correctly, it should be ready after 15h