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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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;