Attaching ContentSizeFitter breaks index of characterInfo

Attaching ContentSizeFitter (even with unconstrained values) component to GameObject with TextMeshProUGUI component makes textInfo.characterInfo return wrong materialReferenceIndex:

Way to reproduce - fast:

  1. Download and Import attached unitypackage
  2. Open and Play Scene 23 - Animating Vertex Attributes

Way to reproduce - slow:

  1. Import TMP Essential Resources (Window → TextMeshPro → Import TMP Essential Resources)
    2. Import TMP Examples & Extras (Window → TextMeshPro → Import TMP Examples & Extras)
    3. Open Scene 23 - Animating Vertex Attributes
    4. To see the problem more clearly: Remove VertexJitter component from TextMeshPro Text object
    5. To see the problem more clearly: Change component VertexColorCycler code line 63
    from*:*
    c0 = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255);
    to*:*
    c0 = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 0);
  2. Duplicate TextMeshPro Text object. Change position of the copy so that they do not overlap each other on screen.
  3. Add ContentSizeFitter component to any one of TextMeshPro Text copies. You can leave params of this component as default (Unconstrained) values*.*
  4. Play scene. The order of disappearance of letters is different.

6015776–648464–TMP_ContentSizeFitter_bug.unitypackage (3.2 MB)

3 Likes

What version of the TMP package are you using?

I just tested with Preview 14 and everything appears to be working correctly. Let me know if you still get the issue with Preview 14?

Can’t see “Preview 14”. It reproduces to all versions

Ohhh, I see now. I have not used preview packages. In Preview 14 it reproduces when ContentSizeFitter placed on parent object: