I am having the same problem…
pasted in the code from the unity scripting manual…
Tried every option for color name… but it always shows up white…
I debug logged the property, and the values are what I set it to.
I can click on the object while its running and change the material color just fine.
but using this script doesn’t create a material with the defined color… its always white, what is wrong with it please ?
string shaderText =
“Shader "Alpha Blended" {” +
“Properties { _Color ("Main Color", Color) = (160,170,10,80) }” +
“SubShader {” +
" Tags { "Queue" = "Transparent" }" +
" Pass {" +
//" Blend One One ZWrite Off ColorMask RGBA" + //Blend One One
" Blend SrcAlpha OneMinusSrcAlpha ZWrite Off ColorMask RGBA" +
" Material { Diffuse [_Color] Ambient [_Color] }" +
" Lighting On" +
" SetTexture [_Dummy] { combine primary double, primary }" +
" }" +
“}” +
“}”;
myMaterial = new Material(shaderText);
//none of these work, not the color above… its always white ?
//myMaterial .SetColor(“Main Color”, new Color(160, 170, 10, 80)); !!!
//myMaterial .SetColor(“_Color”, new Color(160, 170, 10, 80));
//myMaterial .SetColor(“color”, new Color(160, 170, 10, 80));
//myMaterial .SetColor(“_Emission”, new Color(160, 170, 10, 80));
//myMaterial .color = new Color(160, 170, 10, 80);