Skip to main content
Search our knowledge base

How to use Shader Features with Asset Bundles?



  • cpxnet

    I made a test and it's still not working in 5.6.1f1

    Given a shader with

    #pragma shader_feature _ RED BLUE GREEN

    and a variant collection containing all four variants.

    only _(white) and RED is included in the AssetBundle.


    I have a small testcase

    Can someone explain?

  • Marcus Seehuber

    I've tested this in Unity 2019.3.15f1 and the ShaderVariantCollection is simply ignored. Not even calling Warmup manually on it works. The problem probably is that the AssetBundle build another version of the shader inside of the bundle which is not correctly referenced by the ShaderVariantCollection in the AssetBundle. 

    What works is cloning all external shaders to the loader Unity project, copying the ShaderVariantCollection there and assign it in the Graphics settings.


Article is closed for comments.