- Home /
Problem with alpha coloured shader
Whenever I make changes to the shader, it does not apply to the image. I change the _Color ("Main Color", Color) = (0.1, 0, 0, 0.5) but no changes. And the effect is different in different images.
I have an image like this
And a custom shader (taken from http://shattereddeveloper.blogspot.com/2012/11/creating-colored-unlit-alpha-texture.html)
Shader "NAKAI/Unlit/Transparent Colored" {
Properties {
// Adds Color field we can modify
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Lighting Off
SetTexture [_MainTex] {
// Sets _Color as the 'constant' variable
constantColor[_Color]
// Multiplies color (in constant) with texture
combine constant * texture
}
}
}
}
Why the changes doesn't take place and the effect is different? Is there something wrong with the shader? Do you have any other shader for alpha coloured?
it seems ok to me, but I think that if you have attached it to a material and than you change the default color proprierty has no effect. Try reattaching this shader to the material after change, or to modify the color in the ispector or from script with material.SetColor
To restate the above comment, that Color=
is only for the starting color when you make a new $$anonymous$$aterial.
It's like in a Unity script, how changing public int x=10;
to 20 won't do anything, since the Inspector stays 10.
Answer by HappyMoo · Jan 27, 2014 at 04:02 AM
You need to change the Main Color on the Material in the Inspector or Reset your Material Settings in the gear menu at the top/right