Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

TextMesh Pro Textmeshpro Text alpha does not react to new alpha assigned over time [Solved]

Discussion in 'Unity UI & TextMesh Pro' started by simonlvschal, Nov 8, 2018.

  1. simonlvschal


    Nov 17, 2015
    so as title suggest i am trying to make textmeshpro alpha change over time. but for some reason it doesn't exaclty do this.

    instead of going from 0-1 or 0-255 it does so instantly.

    this is the corutine

    Code (CSharp):
    2. protected IEnumerator ShowZoneName(string zoneName,TextMeshProUGUI textMeshProUGUI,GameObject gameObject)
    3.     {
    4.         float t = 0;
    5.         Color startColor = new Color(255,255,255,0);
    6.         Color endColor = new Color(255,255,255,255);
    8.         textMeshProUGUI.color = startColor;
    9.         textMeshProUGUI.text = zoneName;
    11.         while (t < 1)
    12.         {
    13.             textMeshProUGUI.color = Color.Lerp(startColor, endColor, t);
    14.             t += Time.deltaTime / 5f;
    15.             Debug.Log(t);
    16.             yield return null;
    17.         }
    19.     }

    Never mind solved it. i had to use Color32 instead
    Last edited: Nov 8, 2018
    Stephan_B likes this.