Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scenes in Assetbundles and shaders: Endlessly recreating the same shader variants?

Discussion in 'Shaders' started by MikeHergaarden, Jan 23, 2019.

  1. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    We have about 15 levels in our game now, each in its own assetbundle.
    When building the assetbundles its taking ages nowadays because of shader variants, e.g, see:

    https://gyazo.com/585b2cf86a6aaeb6130db12e42ae7802

    I don't get why Unity is seemingly re-creating the same shader variants for every of these levels. We already have a shader variants collection file ("global.shadervariants" inside our "global" assetbundle, all scenes have a dependency on this "global" assetbundle)

    We already use a shader post processor to strip unused variants to try and save some time, but the bigger issue is: Why is Unity doing all this work 14 times too much?
    Is there some way to force Unity not to check shader variants per scene when using a predefined shader variant collection?
     
    Last edited: Jan 23, 2019
  2. sschoellhammer_snowprint

    sschoellhammer_snowprint

    Joined:
    Dec 18, 2018
    Posts:
    8
    @MikeHergaarden did you ever get to the bottom of this? I'm wondering about the same thing ..
     
  3. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Nope, we upgrade to Addressables + Unity 2019.3 in the meanwhile, but the problem remains the same