We're having a lot of headaches due to Unitys strange (broken?) transparent object [rendering order][1].
Luckily we're able to set the rendering order manually using *[Material.renderQueue][2]*. The problem with this technique is that the value will not be saved in the material.̶ ̶*̶U̶n̶i̶t̶y̶*̶ ̶t̶h̶i̶n̶k̶s̶ ̶t̶h̶e̶ ̶m̶a̶t̶e̶r̶i̶a̶l̶s̶ h̶a̶v̶e̶ ̶c̶h̶a̶n̶g̶e̶d̶,̶ ̶s̶o̶ ̶i̶t̶ ̶c̶r̶e̶a̶t̶e̶s̶ ̶n̶e̶w̶ ̶v̶e̶r̶s̶i̶o̶n̶s̶ ̶o̶f̶ ̶t̶h̶e̶ ̶m̶a̶t̶e̶r̶i̶a̶l̶s̶,̶ h̶o̶w̶e̶v̶e̶r̶ ̶t̶h̶e̶ ̶v̶a̶l̶u̶e̶s̶ ̶a̶r̶e̶ ̶g̶o̶n̶e̶ ̶w̶h̶e̶n̶ ̶t̶h̶e̶y̶ ̶a̶r̶e̶ ̶l̶o̶a̶d̶e̶d̶ ̶a̶g̶a̶i̶n. (Unity did think we had changed the materials, because we did the mistake of marking them all as *dirty*). However, *Unity* keeps overwriting the changes every time we: load a scene, save a scene etc. (which is all the time). To solve this we basically have had to hook up to a lot of events in *Unity* just to write our values back into the materials all the time.
If the materials had kept their renderQueue values, this huge lot of code and headache could have disappeared. (Or even better, ordered surfaces according to their z-value in camera-space, which is supposed to be the standard)
If anyone has an elegant solution, or less annoying workaround than continuously rewriting material renderQueue values, please share with us!
So far this rendering problem is taking up between 20-40% of our game level design time.
ps. we have a lot of layers to handle, so writing custom shaders just to cope with depth (what we did first) is not an option
I wish this request had gained more traction. It's really important for 2D-games using parallax effects.
[http://feedback.unity3d.com/forums/15792-unity/suggestions/2403372-graphics-transparent-objects-sorting-bug][5]
![alt text][3]
[http://forum.unity3d.com/threads/137026-How-can-I-save-material-renderqueue-permanently?p=931097#post931097][4]
[1]: http://answers.unity3d.com/questions/143045/transparent-objets-sorting.html
[2]: http://unity3d.com/support/documentation/ScriptReference/Material-renderQueue.html
[3]: http://answers.unity3d.com/storage/temp/982-render_order_bug.jpg
[4]: http://forum.unity3d.com/threads/137026-How-can-I-save-material-renderqueue-permanently?p=931097#post931097
[5]: http://feedback.unity3d.com/forums/15792-unity/suggestions/2403372-graphics-transparent-objects-sorting-bug
↧