I’m attempting to use a depth mask to hide a plane with a transparent/diffuse texture on it. It works great in the unity editor, but as soon as I hit play the plane with the texture on it can be seen as though the mask weren’t there at all. Could anyone tell me why this is happening and how I might fix it?
Below is the shader and the render queue script I’ve got on the masking object:
Shader "Masked/Mask" {
SubShader {
Tags {"Queue" = "Geometry+10" }
ColorMask 0
ZWrite On
Pass {}
}
}
using UnityEngine;
[AddComponentMenu("Rendering/SetRenderQueue")]
public class SetRenderQueue : MonoBehaviour {
[SerializeField]
protected int[] m_queues = new int[]{3000};
protected void Awake() {
Material[] materials = renderer.materials;
for (int i = 0; i < materials.Length i < m_queues.Length; ++i) {
materials[i].renderQueue = m_queues[i];
}
}
}