Search Issue Tracker

By Design

Postponed in 5.6.X

Votes

5

Found in

5.6.0f3

Issue ID

903541

Regression

No

Custom shaders are being included in the AssetBundles even if they are in the "Always Included Shader" list

Asset Bundles

-

Reproduction Steps:
1. Open User's project
2. Notice that "BundleSource/TextureCube/textured_cube" is included to "textured_cube" AssetBundle
3. Set "texture_cube/cube" material shader to "My Custom/Diffuse"
4. Add "My Custom/Diffuse" shader to "Always Include Shader" list
5. Build AssetBundles from menu bar "AssetBundles/Build bundles"
6. Open "AssetBundles/AssetBundleViewer"
7. Select "StreamingAssets/GeneratedBundles/textured_cube"
8. Double click on "My Custom/Diffuse"
9. Notice that it is Precompiled and included to AssetBundle

10. Do the same with "Standard" or other default shader
11. Notice that it is not included and Precompiled it is only referenced

Expected behaviour: All shaders are only referenced in the AssetBundles if they are included into "Always Include Shader" list.
Actual result: Custom shaders are compiled and included in the AssetBundles even if they are included into "Always Include Shader" list.

Reproduced on versions: Unity 5.5.3p2, 5.6.0f3, 5.6.0p3
Could not test on 2017 (AssetBundleViewer did not work)

  1. Resolution Note:

    Adding support for this in the BuildPipeline API is non-trival and not something we wish to support. We will readdress adding support for this in the Scriptable Build Pipeline once Player Building & Asset Bundle Building are unified in that package.

Comments (2)

  1. Jens_Eopus

    Oct 15, 2018 10:38

    This issue is still present in 2018.2.11f1 and 2018.3.0b5.

    Due to this bug AssetBundles with non-standard materials can't be used across different Unity versions

  2. Koen-Matthijs

    Nov 01, 2017 16:41

    Also happens on 2017.2.0f3

    Can be reproduced like this (eg with the Unity TextMesh Pro package):

    1. Create a new project and import TextMesh Pro (see Unity Essentials package)
    2. Preprocess any font (e.g. Arial) into Arial SDF (which uses e.g. the TMP_SDF shader)
    3. Add a UI Canvas to the scene, and add a TMP Text object and set the font to the TMP Font 'Arial SDF". Create a prefab from the TMP Text Object.
    4. Add the same shader as used in the font on the TMP Text object to the list of "Always included shaders" for the project
    5. Delete the object from the scene so there's no reference to it anymore but for the prefab in the Asset DB. (not necessary but just to keep it clean)
    6. Assign any AssetBundle name to the prefab
    7. Build the assetbundle and notice that the assetbundle also includes the Shader that we previously added to the list of Always Included shaders

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.