My Unlit/TextureTransparent shader always shows full white...

…unless I modify the shader file through VS and make Unity re-compile it. Then it works. But when I get a build & run, the problem still exists.

I am kinda new to Unity and already a UE4 programmer.

The problem is that I am creating all of my materials with the script like this:

mProgram = new Material(Shader.Find(“Unlit/tex”));

and fully using GL commands to draw on the screen.

My shader code is like this:

Shader “Unlit/tex” {
Properties {
_MainTex (“Texture”, 2D) = “white” {}
}

SubShader {

Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100

ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Cull Off

Pass {
    CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        struct appdata_t {
            float4 vertex : POSITION;
            float2 texcoord : TEXCOORD0;
	float4 color : COLOR0;
        };

        struct v2f {
            float4 vertex : SV_POSITION;
            float2 texcoord : TEXCOORD0;
	float4 color : COLOR0;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;

        v2f vert (appdata_t v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.texcoord = v.texcoord;
			o.color = v.color;
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            fixed4 col = tex2D(_MainTex, i.texcoord) ;
            return col;
        }
    ENDCG
}

}

}

Thank you for the answers in advance,

i’m looking at this Properties { _MainTex ("Texture", 2D) = "white" {}. That means the default texture used for that input will be a white texture.

My first thought is that you are not setting the texture properly or there is a bug in unity with setting the texture. Can’t say more without seeing the material setup code.