- Home /
GUIElement.color
Why in this section my .color is not recognized as beeing a member of GUIElement ?
function fade(direction:boolean){
var alpha;
if (direction){
if (guiElement.color.a < 0.5){
timeLeft = timeLeft - Time.deltaTime;
alpha = (timeLeft/fadeDuration);
guiElement.color.a=0.5-(alpha/2);
} else {
timeLeft = fadeDuration;
}
} else {
if (guiElement.color.a > 0){
timeLeft = timeLeft - Time.deltaTime;
alpha = (timeLeft/fadeDuration);
guiElement.color.a=alpha/2;
} else {
timeLeft = fadeDuration;
}
}
}
Comment
Best Answer
Answer by iwaldrop · Oct 06, 2012 at 01:50 PM
GUIElement.color does not exist. Perhaps you're looking for GUI.color instead? Setting GUI.color will affect each GUIElement that comes after it, so make sure you set GUI.color back to whatever color you want for the elements which appear after the element your trying to modify!
Your answer
Follow this Question
Related Questions
Help with coloring a button? 1 Answer
Multicolor GUI Labels/text? 4 Answers
guiTexture color half alpha White? 1 Answer
New UI system 4.6, how to change font color? 2 Answers
How to change font color 4 Answers