Search Issue Tracker

Fixed in 1.4.2 & 2.0.2

Votes

0

Found in [Package]

1.4.0 - preview.1b

Issue ID

1164383

Regression

Yes

[TextMeshPro] IndexOutOfRangeExceptions in TMP_InputField.cs are thrown when entering Chinese text in TMP Input Field

Package: TextMeshPro

-

To reproduce:

1. Download attached "TMP_InputField_680930.zip" project and open in Unity
2. Open "Repro" scene
3. Change your Keyboard input source to Chinese (Pinyin - Simplified)
4. Enter to Play mode
5. Enter random characters and press the Spacebar fast

Expected results: No Errors or Exceptions occur
Actual results: IndexOutOfRangeExceptions are thrown:

"IndexOutOfRangeException: Index was outside the bounds of the array.
TMPro.TMP_InputField.GenerateCaret (UnityEngine.UI.VertexHelper vbo, UnityEngine.Vector2 roundingOffset) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_InputField.cs:3307)
TMPro.TMP_InputField.OnFillVBO (UnityEngine.Mesh vbo) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_InputField.cs:3275)
TMPro.TMP_InputField.UpdateGeometry () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_InputField.cs:3213)
TMPro.TMP_InputField.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_InputField.cs:3188)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at /Volumes/External/Applications/2019.3/Unity 2019.3.0a7_ec42ba0792fd/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:198)
UnityEngine.Canvas:SendWillRenderCanvases()"

Notes:
- This issue appears both on Windows and macOS
- This Error is not 100% reproducible, so, it's necessary to repeat multiple times 4 and 5 steps in order to generate the Issue
- It is hard to find is there are regression because Project always corrupts itself if I try to change Package to 1.3.0 so I referencing regression from case 1146626

Reproducible on Package versions: 1.4.0 - preview.1b and 2.0.1
Not Reproducible with package versions: 1.3.0

Reproduced on Unity 2018.4.3f1, 2019.1.8f1, 2019.2.0b7 and 2019.3.0a7

  1. Resolution Note (fix version 1.4.2 & 2.0.2):

    The issue has been resolved. The fix for this issue will be included in the next release of the TMP package which will be version 1.4.2 for Unity 2018.4 and 2.0.2 for Unity 2019.x.

Comments (2)

  1. paulyp1

    Aug 26, 2021 20:59

    Bump again, as of 8/26/21 I am receiving this exact issue and error on Unity 2020.3.8f1, it is also only reproducible sometimes at random.

  2. vvmichalk

    Jul 14, 2021 09:46

    Unity 2020.3

    IndexOutOfRangeException: Index was outside the bounds of the array.
    TMPro.TMP_Text.DrawTextHighlight (UnityEngine.Vector3 start, UnityEngine.Vector3 end, System.Int32& index, UnityEngine.Color32 highlightColor) (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMP_Text.cs:7073)
    TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:4305)
    TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:1647)
    TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TextMeshProUGUI.cs:224)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/Program Files/Unity/Hub/Editor/2020.3.3f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:217)
    UnityEngine.UI.ScrollRect:LateUpdate() (at C:/Program Files/Unity/Hub/Editor/2020.3.3f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/ScrollRect.cs:808)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.