I’ve taken all _Color fields out of my shaders because I rarely need to multiply my Diffuse by a color,
but somtimes it turns likes bellow on ios decive :
It likes shader goes wrong Dose someone kown why? Thanks…
I’ve taken all _Color fields out of my shaders because I rarely need to multiply my Diffuse by a color,
but somtimes it turns likes bellow on ios decive :
It likes shader goes wrong Dose someone kown why? Thanks…
Additional I am using Unity4.2.2 Even Diffuse shader may turns wrong
Many of the built-in Unity shaders require a _Color property to be present.
If you’re using any of them as a fallback (including the shadow caster/receiver passes) then you’ll need to keep the _Color property in there for them to use. Even if it’s not used in your shader.
Thanks for reply.
Here is my code :
It could be wrong sometimes when load a level, but after remove _Color,just like Mobile/Diffuse, it goes right…
But I really need a _Color property
try this
Shader "Mobile/ColoredDiffuse"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 150
CGPROGRAM
#pragma surface surf Lambert exclude_path:prepass noforwardadd
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
half2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb * _Color.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Mobile/VertexLit"
}
You have a typo there;
should be;
uniform fixed4 _Color;