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

Every scene triggers a "Compiling Shader Variants" for the same shader

Discussion in '2018.3 Beta' started by Peter77, Oct 1, 2018.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,589
    I have two uber-like shaders in my game, that are used in every scene. While building a Player, I observed Unity runs "Compiling Shader Variants" for the same shaders for every scene now, burning precious build time.

    Every time I switched to Unity during a build, it was running this step again:

    unity_compiling_shader_variants.png

    Is this the correct behavior, that Unity compiles shader variants for the same materials for every scene now?
     
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    Could you raise a bug about this so we can investigate in detail. Just some thoughts though:

    1: Are all variants used in both scenes? Maybe some are in scene one, some in scene two so you see the dialog for the additional variants in the other scene.
    2: Maybe we are not actually compiling here but just showing the scanning of the variants to see if they exist already in the shader cache.
    3: Is this slower than before? Do you have any data on if there is actually a slowdown or is the added debug info (variant count is new) just making it _feel_ slower?
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,589
    I was running, measuring and comparing build times today and Unity 2018.3 is not building slower.

    The build takes pretty much the same time in 2017.4 and 2018.3.0b3. It seems having the "Compiling Shader Variants" progress bar, which was showing the same shader over and over, was just giving the impression of the build being slower, but it actually is not.

    Do you want a bug-report for this anyway?
     
    LeonhardP likes this.