Search Unity

UnityShaderCompiler taking 6+ hours during a PC or Mac build

Discussion in 'Shaders' started by swiftest, Dec 10, 2014.

  1. swiftest

    swiftest

    Joined:
    Apr 30, 2009
    Posts:
    75
    Just upgraded to Unity 4.6 from 3.5 with a fairly large released mobile/desktop game project so we can add Steam support. The problem now is builds take upwards of 6 hours or more to complete (last attempt took over 12 hours before I killed Unity), and it's always stuck at the "Building Additional Assets" stage. Looking at the process list on PC and Mac OS shows that multiple UnityShaderCompilers are running. The builds never took more than 5-10 minutes with Unity 3.5.

    The memory footprints of these UnityShaderCompiler processes seem to grow and shrink, and Unity is not completely unresponsive albeit very slow in window refreshes. So it doesn't appear to be hung. Just something strange going on with those UnityShaderCompiler processes.

    I'm pretty new to 4.6 and the documentation I've perused doesn't mention a way to see what particular shader the editor is trying to compile. Does anybody have any pointers or advice on how I can tackle this? We integrated quite a few Unity Store Assets, so there are quite a few shaders in the project.

    Thanks for reading!
     
  2. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Builds should only take a few minutes (maybe 10/15 mins on a large project) so something is definitely going wrong. I've had some rogue 'UnityShaderCompiler' processes hanging around too but I'm not sure that's your real issue.

    Probably best to try doing a build with just a single scene included in the build settings and then add your other scenes until the problem occurs. You can also check your editor build log from the console window and see if any errors are being logged at the bottom of the file. If it doesn't work with one scene try it without any or try it with a blank scene.

    If it still doesn't work and you definitely think it's shader related I'd go through all your shaders and replace them with just a basic empty shader one by one until you find the one causing the problem.
     
  3. swiftest

    swiftest

    Joined:
    Apr 30, 2009
    Posts:
    75
    Thanks for your suggestions. Doing single scenes didn't reveal the problem for us. I found the package that seemed to create the long build times by replacing all the .shader files with a bare-bones shader.