- Home /
This question was
closed May 10, 2013 at 09:28 AM by
Fattie for the following reason:
Problem is not reproducible or outdated
Question by
Aurecon_Unity · Nov 22, 2011 at 01:14 AM ·
draw order
Script messing with Draw Order?
Hi All
I have a script that is applied to parent objects that basically changes the shader of all children to a transparent/diffuse, and links up the alpha value to a slider in another script.
function Update () {
for (var child : Transform in transform) {
child.renderer.material.shader = Shader.Find("Transparent/Diffuse");
child.renderer.material.color.a = TransparencyGlobalSlider.SliderValue;
}
}
It works as intended, however there is one strange side effect.
Basically it appears to mess with the draw order - any parent that has this script applied to it, the child objects become visible through other objects.
So for instance I have a road object, and a bridge object underneath. If I apply this script to both, suddenly the bridge is able to be seen when it should actually be under the road.
Any idea why this would happen?
Comment