Search Issue Tracker


Fixed in 2021.3.28f1, 2022.2.19f1, 2023.1.0b15, 2023.2.0a13



Found in




Issue ID




Shader references are lost when building assets with BuildPipeline.BuildAssetBundles



Reproduction steps:
1. Open the user's attached project ""
2. Open "SampleScene"
3. Open "Editor/BuildAssetbundle.cs" and change the BuildTarget in line 82 to the current platform
4. Click "CustomTools/BuildAssetbundleForTestBug" in the menu bar
5. Observe ObjA and ObjB in the Hierarchy window

Expected result: ObjA's Material is using "Unlit/ShaderA", ObjB's Material is using "Unlit/ShaderB", shaders "Unlit/ShaderA" and "Unlit/ShaderB" are listed under the "Two Shader Refs" component on ObjA
Actual result: ObjA and ObjB's Materials are using "Standard" shader, shaders are missing from the "Two Shader Refs" component on ObjA, ArgumentNullException is thrown

Reproducible with: 2019.4.21f1, 2019.4.36f1, 2020.3.29f1, 2021.1.0a7, 2021.2.12f1
Not reproducible with: 2019.4.20f1, 2021.1.0a6
Could not test with: 2022.1.0b8, 2022.2.0a4 ("Unable to open archive file", "Failed to read data for the AssetBundle", "NullReferenceException")

Note: Regressed versions match the fixed versions of case 1178737 and case 1289806

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.