Search Unity

TextMesh Pro ArgumentOutOfRangeException in TMP_InputField.Delete

Discussion in 'UGUI & TextMesh Pro' started by hungrybutterfly, Oct 19, 2019.

  1. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    Using 1.4.1 verified on PC I'm seeing a lot of this

    ArgumentOutOfRangeException: Index and count must refer to a location within the string. Parameter name: count

    System.String.Remove (System.Int32 startIndex, System.Int32 count) (at <7ba07f088431485bb722f3b3373e87ee>:0)
    TMPro.TMP_InputField.Delete () (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    TMPro.TMP_InputField.Insert (System.Char c) (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    TMPro.TMP_InputField.Append (System.Char input) (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    TMPro.TMP_InputField.KeyPressed (UnityEngine.Event evt) (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    TMPro.TMP_InputField.OnUpdateSelected (UnityEngine.EventSystems.BaseEventData eventData) (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IUpdateSelectedHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at <201e781509bb45d1b9d03d931181326d>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <201e781509bb45d1b9d03d931181326d>:0)
    UnityEngine.EventSystems.EventSystem:Update()

    As well as this

    System.String.Remove (System.Int32 startIndex, System.Int32 count) (at <7ba07f088431485bb722f3b3373e87ee>:0)
    TMPro.TMP_InputField.Backspace () (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    TMPro.TMP_InputField.KeyPressed (UnityEngine.Event evt) (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    TMPro.TMP_InputField.OnUpdateSelected (UnityEngine.EventSystems.BaseEventData eventData) (at <d46d48c74cac4600b56f44eeb94f1e44>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IUpdateSelectedHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at <201e781509bb45d1b9d03d931181326d>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <201e781509bb45d1b9d03d931181326d>:0)
    UnityEngine.EventSystems.EventSystem:Update()

    I can replicate it fairly reliably by having an input field with some text in it and hammering Backspace and Delete at the same time.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please test with the latest release which is version 1.5.0-preview.1.

    Preview.2 should be out within a few days.
     
  3. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    Fixed. Thanks
     
  4. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    OK Preview 1 seemed to help with English but I'm still seeing a lot of this from Japanese users. What's the release date for Preview 2?
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What are the steps to reproduce this issue with Japanese text?

    Can you provide me with some repro scene or submit a bug report with repro project?
     
  6. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    This was captured on a Korean PC but I think this affects Chinese and Japanese.

    https://cdn.discordapp.com/attachme...38705804253593615/2019_10_29_20_47_47_372.mp4

    You'll notice that characters typed are surrounded by the <u> </u> block, but pasting Korean characters from outside the app works fine. Eventually it ends with the Backspace error message as the user presses Backspace to delete characters. This is using 1.5 Preview 1.

    Is this just my fonts not being set up properly?
     
  7. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    Here's another repro sent in by a Japanese user.

    1.Edit a name made up of only 2 bytes(they game some example characters here but they're blocked which I try to post)
    2.Enter 2byte characters.(It looks like this (<u>"some 2byte character"</u>)
    3.Press a backspace key twice.
    4."ArgumentOutOfRangeException occurs
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you able to reproduce this without using the underline tags?

    Getting the exact characters and sequence to reproduce the issue would be most useful.

    What are the settings on the Input Field?
     
  9. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    The underline tags appear simply by typing the Korean characters.

    I've attached the example characters in a text file.

    Here's another repro submitted by a Japanese user.

    1. Click the form to edit bot name. Now the whole string is selected.
    2. Type some characters with IME in Japanese mode. (In 128.5, the "currently inputting" characters are shown as https://gyazo.com/328d79e576bd9959c48534eec84fc17a, enclosed by <u> tag)
    3. Remove all inputting characters with Backspace or Delete.
    4. If you type n characters and push Backspace n times, the head character still remains.
    5. Backspace again, the error occurs.

    Here's the Input Field settings

    InputField.png

    Here's the Placeholder settings.

    Placeholder.png
     

    Attached Files:

  10. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    Any thoughts about this yet?
     
  11. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    It's been 2 weeks since last reply. Any suggestion greatly appreciated.
     
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Will try taking a look today / tomorrow. Will provide feedback as soon as I have more information.
     
  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you check if you have Rich Text on the Input Field enabled or disabled?
     
  14. hungrybutterfly

    hungrybutterfly

    Joined:
    Nov 19, 2013
    Posts:
    13
    Rich text is disabled. You can see my settings in the pictures I posted earlier in this thread.