- Home /
Change MANUALLY GUIText's.text COLOR
I put a GUIText on a WHITE panel, the text isn't shown.. obviously(Default is white guitext's.text color)
I can see the text in runtime with this:
guiText.material.color = Color.black;
The question is: How can I manually edit the Material's color?
*Another thing, in run-time the material slot isn't null, means there's a "font material" added to that slot, and in brackes instance. font material(instance)
When I go to that material in my project tab, the color is blocked
, I can't access it..
Answer by Mike 3 · Jul 16, 2010 at 02:04 PM
Try create a new material, set the colour, then add the font texture from inside the font
You should be able to assign pretty much any transparent shader you want, though GUI Text or an unlit shader will work well
Created a new material; 2. Set the color to black. 3. changed the material's shader to "GUI/Text Shader". 4.It's really black now, but the font looks too bad - not readable.
$$anonymous$$ake sure both the font texture and the font used on the guitext match up, or else it'll look screwy
Ofcurse they match, but I managed to solve this a new shader which can't be found in Unity's assets folder. I'll answer on my question as a solution. Thank you anyways mike! goto mIRC :<
Answer by AnaRhisT · Jul 16, 2010 at 02:30 PM
Solution:
Shader "GUI/Text Shader with Z test" { Properties { _MainTex ("Font Texture", 2D) = "white" {} _Color ("Text Color", Color) = (1,1,1,1) }
SubShader { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Lighting Off Cull Off ZTest Always ZWrite Off Fog { Mode Off } Blend SrcAlpha OneMinusSrcAlpha Pass { ZTest LEqual Color [_Color] SetTexture [_MainTex] { combine primary, texture * primary } } } }
Your answer
Follow this Question
Related Questions
TextArea/Field - Individual Character's foreground and background color. 2 Answers
GameObject text colors in hierarchy panel 1 Answer
3D Text Object does not change to the color specified on Mouse Over 0 Answers
How to display EULA from Doc in Unity? 0 Answers
How to display Greek alphabets 0 Answers