- Home /
How can I change color in GUI text? I have problem
Hi All.
I have problem with changing color in GUI text. I found following solve: http://answers.unity3d.com/questions/8055/how-do-i-change-the-color-of-a-font-in-a-guitext.html "You have to create a new material, indeed. But, the following details are essential to this problem.
The material Shader has to be GUI/Text Shader (instead of the default Diffuse one).
You have to choose what color do you want your text to have using the color selection box for the Text Color field (you can even have semi-transparent fonts if you modify the alpha value).
Every font comes with a font texture (as a child of a font in the Project panel). In the new material you created you have to select your font's texture in the Font Texture field. Now, if you go in the GUI Text in the Inspector and use this new material, you should see your text displayed correctly. If you are not happy with the color, you can go back and modify your new material properties any time."
I made first 2 steps but I have problem with 3 step. What is "font's textures"? How to do it?
Second solve which I found is this script:
#pragma strict
var color:Color;
function Start () {
guiText.material.color = color;
}
function Update () {
}
But if I set this in inspector attached to GUI text and click "play game" - text is hidden
When you create a Guitext with a particular Font you can see "$$anonymous$$aterial" option just underneath the "Font".When you change the Font by default the material will also get changed according to the custom Font you are using.If you click on the Font in the inspector you can see that Font inside your Project folder.With that font you can see the corresponding material and texture which is used to create that font.
Have 2 difference fonts with 2 different colors and assign the fonts to the guitexts
Answer by kapuscianyglab · Jul 23, 2013 at 06:01 PM
Problem solved. After update Unity to 4.2 version, change color is available in GUI text in Inspector.
Your answer
Follow this Question
Related Questions
menu item and add gadjet 1 Answer
GUI, character selection & general menu 1 Answer
an UP-TO-DATE menu tutorial 1 Answer
How do I make a colour editor UI? 1 Answer