void OnGUI(){
GUI.skin = myskin;
Color color = new Color (230f, 0f, 0f, 1f); //文字颜色
Color pcolor =new Color (230, 120, 0, 1); //描边颜色
Rect pos= new Rect(10,10,100,40) ;
MakeStroke(pos, "你好", color, pcolor);
}
void MakeStroke(Rect position ,string txt,Color txtColor,Color outlineColor ){
position.y -=1;
GUI.color=outlineColor;
GUI.Label(position, txt);
position.y += 1*2;
GUI.Label(position, txt);
position.y -= 1;
position.x -= 1;
GUI.Label(position, txt);
position.x += 1*2;
GUI.Label(position, txt);
position.x -= 1;
GUI.color = txtColor;
GUI.Label(position, txt);
}
这个其实就是将写五个字体,然后将他们重叠在一起,看起来就是添加了边框的效果,效果还不错
本文介绍了一种在Unity中实现GUI文字描边的方法,通过在不同位置绘制相同文字来达到描边效果,适用于需要视觉增强的游戏界面设计。
773

被折叠的 条评论
为什么被折叠?



