Search Unity

[Help Wanted] IndexOutofRangeException on TextMeshPro

Discussion in 'UGUI & TextMesh Pro' started by GilbertLau, Aug 28, 2020.

  1. GilbertLau

    GilbertLau

    Joined:
    Dec 3, 2017
    Posts:
    26
    Suddenly, some of my TextMeshPro objects popup this error in the Editor. Those testmeshs are not able to show the text at runtime. I have to recreate them manually in order to solve the problem. It is not the first time it happened and it suddenly came out from nowhere. Is there any know issue and any way for me to fix it quickly? Thanks.

    IndexOutOfRangeException: Index was outside the bounds of the array.
    (wrapper stelemref) System.Object.virt_stelemref_class(intptr,object)
    TMPro.TextMeshProUGUI.Awake () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:141)
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The above message appears to be related to sub mesh objects which were serialized in 2.0.1. These are used whenever fallbacks, sprites or other fonts are used within the same text object.

    I would suggest backing up your project and updating to the latest release of the TMP package which is version 2.1.1 which is available via the package manager. A lot has changed in those newer releases so be sure to review the change log and again to have a backup of the project.