Good day everyone.
The shader that I constructed in Unity 4 worked perfectly and as I upgraded to Unity 5 it only gives me that ugly pink/purple color in game and debugs the error “Material doesn’t have a float or range property “_T””.
Now what google has told me is that this error is just some bug if there is something else wrong with the shader. First it said that it was missing semantics at line 48, so I changed the name to v2f which gave me the material missing property error. The float value is not the problem, does someone spot anything else?
Anyone have any clue about what has changed in Unity 5 - shader wise? Does this have anything to do with DirectX11 or something like that?
Best regards.
Shader "Custom/Ottar_VertexBasic" {
//Texture : ShadowPlane_Tex_01
Properties
{
_MainTex ("Particle Texture", 2D) = "white" {}
_T("Transparency", Range(0,1)) = 1
}
SubShader {
Tags
{
"Queue" = "Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
Alphatest Greater 0
Lighting Off
ZWrite Off
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_builtin
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#pragma target 5.0
float _T;
uniform sampler2D _MainTex;
uniform float4 _MainTex_ST;
struct a2v
{
float4 vertex : POSITION;
float4 texcoord : TEXCOORD0;
float4 color : COLOR;
};
struct v2f
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
float4 color;
};
v2f vert(a2v v){
v2f o;
o.color = float4(v.color.rgb, v.color.a);
if(o.color.b == 1)
{
o.pos = 0;
o.color.a = 0;
}
else
{
o.color.a =o.color.b;
o.tex = v.texcoord;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
}
return o;
}
float4 frag(v2f i) : COLOR
{
half4 texcol = tex2D(_MainTex, i.tex.xy);
return texcol*i.color*_T;
}
ENDCG
}
}
}