Search Unity

TextMesh Pro Font Fallback - Text Attributes not updated

Discussion in 'UGUI & TextMesh Pro' started by moldywarpe, Oct 15, 2018.

  1. moldywarpe

    moldywarpe

    Joined:
    Jan 18, 2017
    Posts:
    31
    Hi Stephan,
    Apologies if I've missed a thread that discusses this ... but I did look.
    Running 2018.1.7.

    I have a font with multiple fallback fonts to support localization.
    If I dynamically change the font color/text alignment etc when using a fallback font the text does not change.
    If the font being used doesn't use the fallback font, no TMP SubMeshUI are allocated, everything works fine.

    upload_2018-10-15_11-3-10.png

    If I dynamically change alignment from center to left then apply strikethrough, the strikethrough mark appears to the left, however the text remains centered...

    Any ideas?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Can you provide an example (script) of how are you changing the color or alignment?
     
  3. moldywarpe

    moldywarpe

    Joined:
    Jan 18, 2017
    Posts:
    31
    Stephan,
    I simply have a reference to the TextMeshProUGUI and set the color e.g. m_text.color = Control.darkColor2;

    This can also be done by simply changing the values whilst running with the same effect i.e. doesn't work for text that is using fallback font.

    If my text includes characters from both the primary font and also from the fallback font, the characters from the primary font change color but those from the fallback font don't. Same things happens if I change alignment, only the primary font characters change alignment...

    Cheers
     
    Last edited: Oct 15, 2018
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    I just tested both changing alignment and vertex color and that appears to be working fine.

    However, changing the faceColor of the material of the primary as opposed to the vertex color (via the .color property) would produce the behavior you describe. In such case (assuming you can use vertex color) you would have to manually sync up the faceColor of the shared material of the submesh objects.

    P.S. Automatic syncing of sub object material properties with the primary is something that I could look into in the future although not trivial to handle given the text object has no way of knowing that some script is modifying its material.
     
  5. moldywarpe

    moldywarpe

    Joined:
    Jan 18, 2017
    Posts:
    31
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Since there is some magic happening behind the scene when using fallbacks, I am not surprised that it is tripping up other assets. I would suggest reaching out to the author of Curved UI (who has always been very responsive to users) and see if he might be able to provide an update for those scenarios.
     
  7. moldywarpe

    moldywarpe

    Joined:
    Jan 18, 2017
    Posts:
    31
    Will do!