Since Unity (using 3.5.7) is always giving (at least for me) meaningless error description, I dont know whats going wrong.
If someone could take a look, that would be nice.
GLSL Error in Fragment Shader: Error 0:38: Incompatible types initialization (and no available implicit conversion) ERROR: 0:39: use of undeclared identifier 'desat'
Hi,
I do not have the possibility to check it now but I think
dot( col.rgb, vec3(0.3, 0.59, 0.11) ); is a vec3
and you need a vec4, so perhaps
vec4 desat = vec4( dot( col.rgb, vec3(0.3, 0.59, 0.11) ), 1.0 );
works
Which iOS device are you testing on? You can’t use GLES2.0 shaders (such as the one above) on devices before the iPhone 3GS - that’s the first one that supports 2.0. Before then you’re limited to fixed function shaders.
You can also use material.color = myColor which is a hard-coded version of setting the _Color value.
Might have better luck with that?
Also, I’m not sure, but material (lowercase) might be a reserved word like transform, gameObject, camera, etc are. Try changing it to myMaterial or mat or something like that?
I am testing on an iPad 1 and a Samsung Galaxy s2. I also tried the material.color shortcut before, which, by looking at the callstack, does the same thing as material.SetColor(x,y) and causes the same error above.
The “material” keyword is only a property of “Renderer”, so its not directly accessible in a MonoBehaviour. In my case its a cached variable of renderer.material, to avoid always calling the getter of property renderer.material.
as of now, the shader is (and probably was) working on iPad and S2. Unity seems to become buggy at times, it didnt update the runtime project for xcode and the apk.
mapTintColor is a Color instance, thus a struct, which means its never null. So that cant be the error.