Search Unity

TextMeshProUGUI.text.textInfo values are not set in versions 1.4.x and above:

Discussion in 'UGUI & TextMesh Pro' started by d_wayne1, Jun 9, 2019.

  1. d_wayne1

    d_wayne1

    Joined:
    Jul 18, 2018
    Posts:
    3
    Hi,

    I just upgraded from Unity 2018.x to 2019.x and the install automatically updated TextMeshPro to version 2.0.1. I updated the scripting runtime to .net 4.0 and compiled my code and noticed that TextMeshProUGUI.text.textInfo values that normally describe the text were all set to 0.

    I use textInfo.lineCount and other textInfo api's for a typewriter display effect on my text. I reverted back to previous versions and noticed that this issue occurs in 1.4.1 also. The last version that worked correctly is 1.3.0.

    To reproduce:
    - introspect or debug log text.textInfo.lineCount or characterCount where text is set.
    - in version 1.3.0, lineCount and characterCount will be populated and correct
    - in version 1.4.1 they will be 0
    - in version 2.0.1 they will be 0

    Has anyone noticed this or has any recommendations?
     
  2. d_wayne1

    d_wayne1

    Joined:
    Jul 18, 2018
    Posts:
    3
    I was able to get this to work by forcing a mesh update prior to checking textInfo. Apparently textInfo only gets populated after the text object is generated. Something must have changed between version 1.3.x and 1.4.x where timing of when the text object is created changed.

    text.ForceMeshUpdate();
     
    DEGUEKAS and Ahvic like this.