Hi All,
I am very new in unity and wanted to learn how to write custom shader. Hence, I started learning from here.
I wrote the same code mentioned in the tutorial but unfortunately it is giving me error:
Material doesn’t have a color property ‘_Color’ UnityEditor.DockArea:OnGUI()
Code:
Shader "Custom/NewShader" {
Properties {
_Color ("Color",Color) = (1,1,1,1)
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
uniform float4 _Color;
struct vertexInput {
float4 vertex : POSITION;
};
struct vertexOutput {
float4 pos : SV_POSITION;
};
vertexOutput vert(vertexInput i) {
vertexOutput o;
o.pos = mul(UNITY_MATRIX_MVP,v.vertex);
return o;
}
float4 frag(vertexOutput i) : COLOR
{
return _Color;
}
ENDCG
}
}
}
I searched unity forum but could not find anything related to it.
It would be great any one help to figure out where is the problem. I am using unity 4.0 pro version.
Please mention any other tutorial series that teach shader writing.
Many Thanks in advance!
This one is pretty good also if you are aiming vertex/fragment shaders as opposed to surface shaders http://en.wikibooks.org/wiki/Cg_Programming/Unity
– SarperS