Hi, I using AlphaCutoff shader to make my life bar circular. Its working half good - the texture disappears but it leaving black solid color behind it.
How can I change to draw _BackText instead of just solid black?
Shader:
Shader "Custom/LifeBar" {
Properties {
_MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}
_BackTex ("Texture", 2D) = "black" {}
_Cutoff ("Alpha cutoff", Range (0, 1)) = 0.5
}
SubShader {
Tags {"RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True"}
Pass{
AlphaTest Greater [_Cutoff]
Material {
Diffuse (1,1,1,1)
Ambient (1,1,1,1)
}
Lighting On
SetTexture [_MainTex] { combine texture * primary }
}
}
}
Script to draw bar:
if (Event.current.type.Equals(EventType.Repaint))
{
mat.SetFloat("_Cutoff", lifePerc);
Graphics.DrawTexture(new Rect((Screen.width - Screen.width / 6) - 5, (Screen.height - Screen.width / 6) - 5, Screen.width / 6, Screen.width / 6), gradient, mat);
}