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

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:


Is this the correct behavior, that Unity compiles shader variants for the same materials for every scene now?

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?

[quote=“Tim-C”, post:2, topic: 716732]
3: Is this slower than before?
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?

1 Like