- Home /
Question by
Vicas · Apr 06, 2014 at 10:56 AM ·
shadertransparencyngui
Alpha Transparent Shader hides NGUI fonts
I am trying to fade out some NGUI text with a transparent alpha shader.
When doing it, this happens:
If I set the NGUI Panels "Render Q" to explicitly 3000 it seems to work fine - but I cannot have all panels in my game be at 3000, as this will screw up the fonts in other cases where they will go hidden. Why does exactly 3000 make it work? And how do I get a shader to fade it out correctly without setting this explicitly in the NGUI render Q?
The shader code is as follows:
Shader "Unlit/Alpha With Fade"
{
Properties
{
_Color ("Color Tint", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white"
}
Category
{
Cull Off
Lighting Off
ZWrite On
Fog { Mode Off }
Offset -1, -1
Blend SrcAlpha OneMinusSrcAlpha
Tags
{
"Queue" = "Transparent"
"RenderType" = "Transparent"
"IgnoreProjector" = "True"
}
SubShader
{
Pass
{
SetTexture [_MainTex]
{
ConstantColor [_Color]
Combine Texture * constant
}
}
}
}
}
Comment
I solved this by changing the material's render queue ins$$anonymous$$d. But somehow I don't find the solution very viable for future projects, as I have to keep track of everything's queue position, which I suppose was what Unity was normally doing.
Your answer
![](https://koobas.hobune.stream/wayback/20220613142054im_/https://answers.unity.com/themes/thub/images/avi.jpg)