Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Unity 5.6 - Build Time is way too long

Discussion in 'Editor & General Support' started by moco2k, Apr 15, 2017.

  1. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Hey everyone,

    usually, it took about 1-2 minutes to build the usual scenes in my project (3 scenes, ~1.5GB final build size, hardware: I7 CPU@3.40 GHz, 8GB RAM). Now, after upgrading to Unity 5.6, it takes about 20 minutes. Most of the build time is taken by globalgamemanagers.assets (~14 min) and resources.assets (~6 min). Something seems to be pretty wrong here. Unfortunately, I have absolutely no idea what's causing this explosion of build time.

    Is someone else also experiencing weird behaviors with build times?

    Also, the console log shows multiple errors of the kind below:
    Shader error in 'Standard (Specular setup)': Too many math instructions for SM2.0 (65 needed, max is 64). Try #pragma target 3.0 at /Unity/Editor/Data/CGIncludes/UnityStandardBRDF.cginc(449) (on d3d9)

    Compiling Fragment program with DIRECTIONAL LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK _NORMALMAP _DETAIL_MULX2
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP

    Do you think some shader errors are able to slow down the build time like this?
    Also, do you have further ideas what I can do to find the cause, or specific things to look for in the Editor.log?

    Any help is much appreciated - thanks in advance!

    Update:
    I've created a new and clean test project and only imported all scrips and essential script asset packages I use. Among these essential packs is the new post processing stack. I found that the post processing stack made some differences for the small test project:
    • Without PP the test project builds in about 2 seconds.
    • With PP it takes about 60 seconds. The time is spent on this step: 'Packing assets - resources.assets.'
    Consequently, I've also removed PP from the normal project to see what happens. It seems that the the first part of the build process indeed is faster, but it still takes way too long and spends an incredibly amount of time at 'Packaging assets - globalgamemanagers.assets'. So, the PP definitely is not the real problem here.

    I've just tried to remove always included shaders as suggested here, but that did not work either for me.

    So, I'm still heavily struggling on this.
     
    Last edited: Apr 19, 2017
  2. OkamiDMC

    OkamiDMC

    Joined:
    Jan 3, 2014
    Posts:
    12
    as same as me, whether on pc or mobile when building, ShaderCache more and more big:(:(
     

    Attached Files:

    • test.png
      test.png
      File size:
      52.9 KB
      Views:
      898
  3. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    113
    Same thing happening here
     
  4. karam89

    karam89

    Joined:
    Aug 23, 2015
    Posts:
    10
    Same here,
    My project was being built in 3 minutes, now with 5.6 it took 40 minutes
     
  5. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,902
    What happens if you disable DX9 support in the Player Settings? Does the build take less time?
     
    moco2k likes this.
  6. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    I had raised an official bug ticket for this some time ago. However, my project is more than 100GB in size so I cannot easily provide it as a repro case. As it seems, Unity QA wasn't able to identify the root cause of this issue yet. However, maybe, if someone else has a smaller project, it could be provided to Unity QA so that they have a better possibility to identify the cause of the problem?

    How would you do this exactly?
     
    Last edited: Jun 25, 2017
  7. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Performance is one thing Unity struggling with, they add features and bug bashing, but not so much improve performance and build times etc.. Importing is slow as crap also for images etc
     
  8. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    After some more testing, I have a strong feeling that this issue is related to the graphics settings, and, in particular, to the new tier settings which have been introduced with Unity 5.6. Still, I cannot create a reliable test case for reproduction. But I think, depending on some internal functionalities related to these settings, for my scene setups, build times can vary from usual ~2 minutes to 20+ minutes.

    It would be nice if the graphics team would have a careful look into these settings. Also, I think the docs should be updated so that they provide more helpful information on how to work with the tier settings and on how to avoid build duration nightmares.
     
  9. teknic

    teknic

    Joined:
    Oct 18, 2012
    Posts:
    32
    Disabling DX9 fixed the Shader error in 'Standard (Specular setup)': Too many math instructions for SM2.0 (65 needed, max is 64). Try #pragma target 3.0 at /Unity/Editor/Data/CGIncludes/UnityStandardBRDF.cginc(449) (on d3d9) error.

    Change this under Player Settings > Other Settings
    uncheck Auto Graphics API for Windows [ ]
    and remove DirectX9 from the list.

    Subsequent builds are very fast after the first one chews through all the shader variants.
     
    moco2k likes this.
  10. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Yepp, this actually did the trick for me. :) Thanks to all for your help.