Search Unity

TextMesh Pro FontStyle and ScrollView Masked

Discussion in 'UGUI & TextMesh Pro' started by Ziboo, Jan 31, 2018.

  1. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    Hi,

    I run into an issue where if I'm changing the fontstyle of a TMP by code and this TMP is inside a scroll view that use a mask or 2d mask rect, it will not update until you scroll... :confused:

    Apparently the scrolling might send a refresh somewhere, but I didn't find how to do that manually.
    I tried all the SetDirty on the TMP, but nothing works..

    Could someone help me plz ?

    Thanks
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The behavior could be different between UI Mask and 2D RectMask. However, in both case, using ForceMeshUpdate() just after changing the style will force an update of the text object.

    I am not sure if by Style you mean a style sheet, material preset or style like bold, italics, etc.

    if the issue persist after using ForceMeshUpdate(), please provide me with a Repro scene so I can take a closer look.
     
  3. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    The issue persist.

    I'm changing the bold style using
    Code (CSharp):
    1.  
    2. if (value )
    3.             {
    4.                 target.fontStyle = target.fontStyle | FontStyles.Bold;
    5.             }
    6.             else
    7.             {
    8.                 target.fontStyle = target.fontStyle & (~FontStyles.Bold);
    9.             }
    10.  
    Edit: Sometime it works, sometime not, but always update correctly after a scroll
    Edit 2: Tried in a new project, and doesn't seem to have the bug, I don't know if it's related to my setup or because I downloaded a new version of TMP
     
    Last edited: Jan 31, 2018
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I don't recall having made any changes related to this in recent versions. What version were you using when getting the behavior you reported?
     
  5. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    In the user guide it says: Release 1.0.54 - Dec 2016
    I really don't understand why my setup is doing that.
    Only thing that could be different from the repro I tried to do in another project, is that I have a custom font. But that's all. So maybe material / stencil related ?
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    To know what version of TMP you are using, take a look at the name of the DLLs in the "TextMesh Pro/Plugins/Editor DLL/..." folder.

    Older versions has a slightly different setup on the DLL locations but they are all still in the Plugins folder.

    The font asset should not impact this nor should the material.

    If you can't figure out what might be causing it, just provide me with a Repro project via PM or thru a bug report.
     
  7. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    So I'm using : TextMeshPro-1.0.55.2017.1.0b11
    I tried to update, but the bug persisted.
    Just to be clear, I used the same code to change the font style elsewhere and it works good.
    It's only when inside a scroll view
     
  8. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    I sent you a repro project via PM. Thanks !
     
    Stephan_B likes this.