Search Issue Tracker
By Design
Votes
5
Found in
5.4.0f3
Issue ID
823414
Regression
No
Materials Custom Render Queue is resetting itself back to default after loading asset bundle
Steps to reproduce:
1. Open attached project
2. Open "Repo shader" scene
3. Select "Sphere" in the Hierarchy
4. Change "Bundle Url" in Bundle Loader (script) component to "file://" + project directory + "Assets/Demo/sphere"
5. Select "GameObject" in the Hierarchy
6. Change "Bundle Url" in Bundle Loader (script) component to "file://" + project directory + "Assets/Demo/cube"
7. Save scene
8. Select "Assets/Textures/Background" material
9. Make sure its custom render queue isn't equal to -1
10. Open "Scenes/ShaderRepo" scene
11. Select "Sphere" in the Hierarchy
12. Make sure its materials custom render queue isn't equal to -1
13. Select "Repo shader" scene, right click -> Build AssetBundles
14. Open "Repo shader" scene
15. Press play
16. Click button "Click!"
17. Select "Sphere" in the Hierarchy after asset bundle gets loaded
18. Observe how its materials custom render queue is reset to default(-1)
Reproduced with: 5.3.6p2, 5.4.0p1, 5.5.0a5
Comments (2)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Toolkit meshes are fully rendered and rasterized when opacity is 0
- Light rendering artefacts appear in the Editor when assigning unsupported 3D Custom Render Texture in Camera’s Output Texture, unclearable errors and warnings spammed
- Memory leak when running a test with "GfxThreadingMode" set to "SplitJobs"
- Loading Unloaded unsaved Scene throws “ArgumentException” error in the Console
- Crash on std::__1::__tree_const_iterator when opening the Build Profiles window in a specific project
eonyanov
Mar 14, 2018 17:18
Had a similar problem in Unity 2017.2.0f3 (64-bit)
bfe_gio
Sep 22, 2016 17:26
Had a very similar problem, but partly the issue turned out to be one of our own scripts.
The script re-assigned shaders to some Material assets; it appears that re-assigning the shader on a Material wipes out its custom render queue value (back to -1). Not sure if that's intended, but adding some code to simply store the old custom value before re-assigning, then setting it back, solved the issue for our case.
Something like:
int oldQueue = material.renderQueue;
material.shader = newShader;
material.renderQueue = oldQueue;