- Home /
Help with text color
Hi there. First of all, here is my code:
var target : GameObject;
var ObjectText : GUIText;
var infoText : String;
var magicText : String;
var level : int;
var isMagic : boolean;
function OnMouseEnter () {
if (isMagic == true) {
ObjectText.text = "Monster: " + infoText + " (Level " + level + ") " + "(" + magicText + ")";
} else {
ObjectText.text = "Monster: " + infoText + " (Level " + level + ")";
}
}
I need a way to make so I am able to change the color of the "magicText" text only. How could I do this?
Comment
Answer by DGArtistsInc · Jan 11, 2012 at 02:34 AM
ObjectText.renderer.material.color = Color.white;
//or whatever color you want it doesn't have to be white
That is how you would change the color of the text or any object with a material really. Put it in your if statement or wherever you want it... if you want it to change color when you click it then put it under your if statement
I just want the "magicText" string's text color specifically to be changed.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to change colour of objects? 1 Answer
How do i add textures without them stretching? 1 Answer
How do I make a colour editor UI? 1 Answer