Search Unity

Question SBP don't strip shader variants?

Discussion in 'Asset Bundles' started by go3000, Aug 9, 2022.

  1. go3000

    go3000

    Joined:
    Feb 17, 2020
    Posts:
    6
    I'm upgrading asset bundle build method to scriptable build pipeline, but the result shows shader bundle size grown from 5MB to 22MB, and deep inside the bundle file I found there are more keywords in SBP
    bundle.

    1. I just use the CompatibilityBuildPipeline API to build bundles, and no other build task added.
    2. I have tried disable fog and lightmap in Graphics settings, but the shader bundle result the same.

    Seems the automatic shader variant strip process is failed in SBP.
    Any idea? Thanks.
     
  2. Alan-Liu

    Alan-Liu

    Joined:
    Jan 23, 2014
    Posts:
    393
    Hi, I encountered this issue before.

    I solved it by using IPreprocessShaders: Firstly, I logged all shader variants to see whether there are redundant variants.
    And I found some keywords are not stripped, so I strip them manually.
     
    go3000 likes this.
  3. go3000

    go3000

    Joined:
    Feb 17, 2020
    Posts:
    6
    Thanks, I did a lot research, and finally did the nearly same process as yours.
     
    Alan-Liu likes this.