Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Inline sprites glitch during alpha fadeout - after upgrade to Unity 2020.2, TMP 3

Discussion in 'UGUI & TextMesh Pro' started by rzubek, Jan 11, 2021.

  1. rzubek

    rzubek

    Joined:
    Aug 21, 2014
    Posts:
    72
    We just upgraded a project from 2019 LTS to 2020.2, and TMP from 2.0.1 to 3.0.3

    I'm noticing one bug with rendering of inline sprites. It happens only in text fields which are being alpha-faded out, like flyout messages.

    Inline sprites in those cases start glitching as soon as alpha starts changing, and it looks like this:
    https://drive.google.com/file/d/14MQb2GleNdOTe1lJeKMXiACyit-ygwuw/view?usp=sharing
    (20mb gif, please give it a minute :) )

    The flyouts in the gif are "10 <icon>" and "insufficient <icon> movement points". As you can see, the icons get glitched immediately, and it looks like their UV coordinates get mixed up - it looks like they start pointing to a different part of the atlas? (You can see it especially well in the "10 <icon>" case, where the icon gets replaced with some unexpected (but consistent) atlas fragment.)

    The code that does tweening is very simple, and unchanged since 2019:

    Code (CSharp):
    1.  
    2. // TMPro.TextMeshProUGUI t = ...
    3. LeanTween.cancel(t.gameObject);
    4. LeanTween.value(t.gameObject, f => { t.alpha = f; }, 1f, 0f, duration)
    5.     .setEase(LeanTweenType.easeInCubic);
    6.  
    I can also confirm that commenting out the alpha fade-out stops the glitch.

    This worked correctly in Unity 2019.4 LTS and its corresponding version of TMP.

    Thank you for any advice you might have on this!
     
    Last edited: Jan 12, 2021
  2. rzubek

    rzubek

    Joined:
    Aug 21, 2014
    Posts:
    72
    Ping - just curious if anyone is seeing this on alpha fadeout as well? (Or not seeing it?)

    It happens for us in the editor, as well as in release builds. Tested on Windows only.

    The Sprite Asset has been built with an older version of TMP (2.0.1) and just brought over, but that shouldn't make a difference? Rebuilding the sprite asset didn't make a difference. And as for the material/shader, the sprite atlas uses "TextMeshPro/Sprite" material, which sounds correct.