hi, how can i make alpha constant like Mathf.PingPong(Time.time, 1.0f); but with an existing text,
i made this
public Text text;
public Color colorT = Color.white;
private void Awake()
{
// GetComponent().color = Color.blue;
}
void Update()
{
colorT.a = Mathf.PingPong(Time.time, 1.0f);
}
void OnGUI()
{
Color colorSave = GUI.color;
//GUI.color = text;
GUI.Label(new Rect(25, 25, 200, 50), “Click Me”);
}
}
but generete a new one i want to a existing one 
Unfortunately, I haven’t used OnGUI in a long time. Is there a reason you are using it?
I’m assuming you want to apply an alpha that changes to a text? (I also didn’t really understand what you were trying to do)
yea i have a text object and i want to make pingpong of alpha
Well, you’ll have to figure out how to set color to text using OnGUI. It’s not really used that much anymore, so it may be harder to find people with experience using it, but I think Unity does still have some documentation on it. Then you should be able to change the color using some sort of change like your pingpong and just have the text access that color and apply it.
I seem to recall using some sort of style code for onGUI back in the day, but again, that was back before the new UI system came out.
Use code tags when posting code, it makes the code much easier to read and preserves formatting.
You’re trying to combine two completely different UI systems. The canvas system - the one you’re referencing with the Text object, and including anything in the UnityEngine.UI namespace - is the modern one, the one covered by the UI tutorials (and absolutely the one you should be using). OnGUI, along with anything “GUI.whatever”, is part of the old GUI system, and is obsolete.
public Text text;
public Color colorT = Color.blue;
void Awake() {
text = GetComponent<Text>();
}
void Update() {
colorT.a = Mathf.PingPong(Time.time, 1f);
text.color = colorT;
}