I have been following a tutorial on how to code shaders and I have run into an odd problem which the Tutorial poster does not have, even though I checked for typos about 10 times and m eyes are starting to hurt. Could anyone look at my code and check if they can find what i did wrong ?
Shader "Shaders/2 - Lambert" { //Shader Path
Properties { //Define any changeable properties here
_Color ("color", Color) = (1.0,1.0,1.0,1.0) //Color property
}
SubShader { //Main Shader
Pass {
Tags { "LighMode" = "ForwardBase" }
CGPROGRAM
//pragmas
#pragma vertex vert
#pragma fragment frag
//User defined variables
uniform float4 _Color;
//Unity defined variables
uniform float4 _LightColor0;
//Base input structs
struct vertexInput{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct vertexOutput{
float4 pos : SV_POSITION;
float4 col : COLOR;
};
//vertex function
vertexOutput vert(vertexInput v){
vertexOutput o;
float3 normalDirection = normalize( mul( float4( v.normal, 0.0 ), _World2Object ).xyz );
float3 lightDirection;
float atten = 1.0;
lightDirection = normalize( _WorldSpaceLightPos0.xyz );
float3 diffuseReflection = atten * _LightColor0.xyz * max( 0.0, dot(normalDirection, lightDirection) );
o.col = float4(diffuseReflection, 1.0);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
return o;
}
//fragment function
float4 frag(vertexOutput i) : COLOR
{
return i.col;
}
ENDCG
}
}
//loads Diffuse in case the Shader doesn't get loaded
//Fallback "Diffuse"
}
Thanks in advance
Edit: exact error message: Material doesn’t have a color property ‘_Color’
UnityEditor.HostView:OnGUI()
Edit: for some reason getting another error message now: rc.right != m_GfxWindow->GetWidth() || rc.bottom != m_GfxWindow->GetHeight()