Search Unity

TextMesh Pro IndexOutOfRangeException in UpdateSDFScale

Discussion in 'UGUI & TextMesh Pro' started by Surmoi, Aug 8, 2018.

  1. Surmoi

    Surmoi

    Joined:
    Aug 9, 2013
    Posts:
    5
    Hello,

    We are seeing a lot of "IndexOutOfRangeException: Array index is out of range" with the following stacktrace in our live error reporting tool (from mobile devices)

    TMPro.TextMeshProUGUI.UpdateSDFScale (Single lossyScale)
    TMPro.TextMeshProUGUI.LateUpdate ()


    Using Unity 5.6.4p3 and TextMesh Pro 1.0.56

    We have no clue on how to reproduce it yet though. Any ideas what could be the problem ?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I would recommend testing with version 1.2.2 to see if you still get those issues.

    To narrow this down further, I would need some type of repro project.
     
  3. Surmoi

    Surmoi

    Joined:
    Aug 9, 2013
    Posts:
    5
    I couldn't find a way to reproduce it outside of our project which I cannot share I'm afraid. We are also unable to upgrade to 1.2.2 at the moment. But here are a couple of findings:
    The issue is triggered with certain Prefabs because of their initial text in the TextMesh Pro component. The text itself doesn't matter, only clearing the text from the component will prevent the exception to trigger (Tried to change other things like, size, scaling, etc. It didn't matter). If the prefab is affected, the exception will be triggered at its instantiation, both in the editor and at runtime. In fact when it's triggered in the editor, Rider detected the unhandled exception, it's caused by the fact the characterCount is different than characterInfo.Length in UpdateSDFScale().
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide any insight on what the content of those text objects are when those errors occur? Does the text contain multiple fonts and sprites or special characters?
     
  5. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    97
    I'm having the same issue right now, after adding fallback fonts to our fonts. We're (still, legacy project) on 1.0.55.2017.1.0b12. I may be able to put a repro project together. Also, can't really update to newer versions as well, stuck on Unity 2017 for now :-/
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    A simple repro project would be great.

    Please note that I am at Unite in LA so won't be able to look into this until the weekend.
     
  7. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    323
    I have the same problem on Android Builds using 1.3.0 and 2018.3f2.

    It happens when I'm instancing a Prefab with TextMeshPro in Runtime.
     
    Last edited: Dec 21, 2018
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Anything special about that prefab?

    Any chance you could provide some simple repro that would enable me to reproduce this on my end?
     
  9. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    I think, for whatever reason, the issue occurs, if you create a TextMeshPro item, inside of a prefab (in non runtime).

    I created a TextMeshPro item, outside of the prefab, and then placed it in with no issue.