Multiple Transparent Materials Merging


I have a cube which I'm putting multiple materials on, using the materials array. However, both the materials are using the Transparent/Cutout/Diffuse shader, which for some reason is making them blend into eachother. It's making the bottom material show through the top material.

I used black for the transparency colour so I find it strange that the 'cutout' would suddenly become partially transparent as well.

It only happens when both materials are transparent, when the bottom material is regular diffuse, the 'cutout' material overlays as it should. I'm not sure how to stop this happening.

I fixed the problem by adding the material to the gameObject.renderer.materials array (Using Unshift()), then setting gameObject.renderer.material.renderQueue to 1. For every material I added to the gameOject.renderer.materials array, I set the renderQueue of the added material to array.Length+1

So now they all overlap in order.