NGUI实现图集变灰功能
http://bbs.9ria.com/thread-434334-1-1.html
这篇资料对于Unity使用NGUI实现图集变灰的教程写得很详细
Unity 5.5.0f3,NGUI为最新版本
找到NGUI--Resources--Shaders-- Unlit - Transparent Colored的第60行代码开始
--------------------------------
fixed4 frag (v2f IN) : COLOR
{
/*
fixed4 col = tex2D(_MainTex, IN.texcoord) * IN.color;
//For gray shader change rgb value
float grey = dot(col.rgb, float3(0.299, 0.587, 0.114));//float3(0.299,0.587,0.114)这里面的三个数值就是代表着RBG值
col.rgb = float3(grey, grey, grey);
return col;
*/
//添加上述代码会直接使得图片变灰
return tex2D(_MainTex, IN.texcoord) * IN.color;//这是NGUI原始的代码
}
-------------------------------
要使得上述代码运行,注释掉即可
改变RBG值使得图片的颜色外观发生变化