Search Unity

TextMeshPro Throws IndexOutOfRange

Discussion in 'Scripting' started by Gizambica, Aug 19, 2019.

  1. Gizambica

    Gizambica

    Joined:
    Jul 12, 2017
    Posts:
    4
    I have a nested prefab in a UI element which contains a TextMeshProUGUI component. Whenever I click play, I get this exception thrown:

    I also noticed that, on that object, a lot of TMP SubMeshUI components are being added. Cant seem to find the reason.

    Unity Version 2019.2.0f1, TMPro version 2.0.1
     

    Attached Files:

  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,290
    Have you tried changing text field to something like "Hello, World!" or even empty string? Your markup looks buggy may be this is the reason.
     
  3. Gizambica

    Gizambica

    Joined:
    Jul 12, 2017
    Posts:
    4
    I'm using Rich Text to add sprites, scales and offsets to my text. May read wrong, but looks right!
     
  4. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,290
    Whatever, try without markup. If will work. it's errors in your markup caused the exception.
     
  5. Gizambica

    Gizambica

    Joined:
    Jul 12, 2017
    Posts:
    4
    Nope, not the rich text. All other instances of the prefab work fine, its this one that stopped. I had to remove the component altogether and add it again for it to work
     
  6. allygj

    allygj

    Joined:
    Jul 10, 2017
    Posts:
    3
    Same thing is happening to me. Except my text is just normal text. The ones with tags are completely fine. And it's only happening on certain objects, even though they are part of a prefab. Sometimes after I delete the submeshs there are no errors, but then the next time I run it there are tons of errors and even more submeshs. I haven't found a way to resolve this yet, but I've tried removing textmeshpro from the project and re-importing it, and nothing.