Hello !
My current code is working nice and shiny. Only problem is that when my label text are fading, my whole gui fades ! That mean’s crosshair… healt bars… etc
How i can fade only this one label ?
var textWidth : int = Variables.NotifyText.Length * 7;
GUI.Label(new Rect(Screen.width/2 - textWidth/2, Screen.height/2 + 150, textWidth * 7, 20), "" + Variables.NotifyText);
TempTextTime -= Time.deltaTime;
if(TempTextTime < 3){
color.a -= Time.deltaTime * 0.35;
}
if (TempTextTime < 0){
color = Color.white;
TempTextTime = TextFadeOffTime; // clamp the timer to zero and stop text showing
Variables.DrawNotifyText = !Variables.DrawNotifyText;
Variables.NotifyText = "";
}
I dont see the usage of color, but you may need to reset the color after you used it for your label, so that the other UI elements may use the original unfaded value.
and this will return old alpha channel value after fading:
if (TempTextTime < 0){
color = Color.white;
TempTextTime = TextFadeOffTime; // clamp the timer to zero and stop text showing
Variables.DrawNotifyText = !Variables.DrawNotifyText;
Variables.NotifyText = "";
}
It works, i don’t want that you think it won’t work !! Problem is that all my GUI fades when i am decreasing color.a -= Time.deltaTime * 0.35; and that’s annoying… i only want to decrease this one specific label GUI.Label(new Rect(Screen.width/2 - textWidth/2, Screen.height/2 + 150, textWidth * 7, 20), “” + Variables.NotifyText);
alpha channel
Hmm that is some nice line of code ! But unfortunaly im getting error: Assets/Scripts/GuiDraw.js(9,22): BCE0024: The type ‘UnityEngine.GUIStyle’ does not have a visible constructor that matches the argument list ‘(function(UnityEngine.Rect, String): void)’.
and unity points var myGuiStyle = new GUIStyle(GUI.Label);
Im totally out of GUI stuff on unity , i hope you still can help me