I just upgraded from 2018.3.13f1 (textmesh pro 1.3.0) to 2019.1.1f1 (text mesh pro 2.0.0) and am now getting the following error on a TMP_InputField when running:
IndexOutOfRangeException: Index was outside the bounds of the array.
TMPro.TMP_InputField.GenerateHightlight (UnityEngine.UI.VertexHelper vbo, UnityEngine.Vector2 roundingOffset) (at Library/PackageCache/com.unity.textmeshpro@2.0.0/Scripts/Runtime/TMP_InputField.cs:3395)
TMPro.TMP_InputField.OnFillVBO (UnityEngine.Mesh vbo) (at Library/PackageCache/com.unity.textmeshpro@2.0.0/Scripts/Runtime/TMP_InputField.cs:3276)
TMPro.TMP_InputField.UpdateGeometry () (at Library/PackageCache/com.unity.textmeshpro@2.0.0/Scripts/Runtime/TMP_InputField.cs:3209)
TMPro.TMP_InputField.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@2.0.0/Scripts/Runtime/TMP_InputField.cs:3184)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:198)
UnityEngine.Canvas:SendWillRenderCanvases()
This occurs when I have one input field and then instantiate a prefab with another Input field and copy the text from the first to the second.
It occurs when you first click on the new input field.
the caretSelectPositionInternal is -1 which is what causes the argument exception. The strange thing is if I step through the value returned that should be set in caretSelectPositionInternal is 0, but doesn’t appear to match (via ClampCaretPos)
Workaround: downgrading to textmeshpro 1.3.0 fixes the issue. (still an issue in 2.0.1 preview)