Helllo all,
I am currently trying my second attempt at making my own shader (the first went badly), so I apoligise in advance if this is relitivly easy as I have little knowlage on shaders. My current goal is to make a Layer Mask.
I am currently coming across a error code as follows:
Shader error in ‘Custom/culling’: Parse error: syntax error at line 11
Code as follows:
Shader "Custom/culling" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Mask ("Mask Texture",2D) = "white" {}
}
SubShader
{
Tags { "Queue"="Transparent" }
Lighting On
ZWrite Off
Blend ScrAlpha OneMinusSrcAlpha
Pass
{
SetTexture [_Mask] {combine texture}
SetTexture [_MainTex] {combine texture, previous
}
}
}
gjf
2
the most obvious thing to me is a missing closing brace on line 16
Shader compilers sometimes give really unhelpful errors, sometimes with completely wrong line numbers. And there are no completion pop-ups, so easy to misspell a word. I’ve found that you always start with working code, and change only a little at a time before testing.
But, in this case, the error IS on line 11, like it says. This man page has what you need to fix it: Unity - Manual: ShaderLab command: Blend
I ran into the same problem earlier and it proved out to be a typo in there: “ScrAlpha” instead of “SrcAlpha”. Took me a while to figure it out, and I hope it will save others some time.
,Ran into the same problem and it proved to be a typo, like the one you have there, “ScrAlpha” instead of “SrcAlpha”. I hope it saves others some time, took me a while to figure it out.