Search Unity

Huge material asset bundles - or why does each material contain duplicates of every shader variant?

Discussion in 'Asset Bundles' started by benjcooley, Feb 9, 2018.

  1. benjcooley


    May 3, 2014
    So shader asset bundles are tiny, but material asset bundles tend to be quite large - even with judicious stripping of unused shaders and variants in the "graphics" settings tab.

    For our content, we see material bundles of multiple megabytes with no shader stripping, but still see shader asset bundle sizes of several hundred K to still over 1MB.

    But.. all materials are Standard materials, and each material asset bundle actually is including the SAME shader variants in each bundle.

    We have tested several variants of how we are creating our bundles, and it doesn't seem to matter whether you bundle all materials at the same time, in a single bundle or separately - each material still seems to get it's own unique collection of variants regardless.

    What we need is the ability to move common variants shared across materials into a separate bundle so they are not duplicated for each material. There seems to be no way to do this.

    In any case, right now Materials - even with the use of the graphics stripping panel - are still generally the largest category of assets by size in all of the content we are processing.


    As a fix, we are considering bundling materials in uncompressed form, then running a binary patcher on the materials against a common material in the bundle set. This would be extreme measures to try to reduce the file size, but this is a pretty big problem for us right now.