Search Unity

TextMesh Pro TextMeshPro index out of range when parsing nested tags

Discussion in 'UGUI & TextMesh Pro' started by TJHeuvel-net, Jan 31, 2018.

  1. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    When trying to use nested tags i'm getting an IndexOutOfRange exception:

    This happens with the following text:

    It seems to be related to the capitalized Link style (which is default), when i use 'link' (lowercased) it works.

    Using Unity 2017.3 and the latest (1.0.56.0b2) release.

    https://streamable.com/nulnr
     
  2. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Ah i've found the source of the error, the default stylesheet for Link also adds a Link tag. Its a bit odd it gives a nullreference, but i guess what i am doing there isnt really supposed to be done anyway. I added them specifically because the manual says adding Link tags wont make them look like links, and i didnt suspect adding the style would.

    I find these stylesheets a bit difficult to use because there is no documentation on them.
     
    Last edited: Feb 1, 2018
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    I am currently travelling to visit my son who is graduating from basic training in the Army. I'll try taking a look at this on Friday when flying back home.
     
  4. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    I've solved our issue, as always its a user error. Though i'd really appreciate some more documentation of stylesheets.
     
  5. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    I'm not sure how you prefer bugs to be reported, i'll just comment one here as to not spam the forum too much.

    It seems like `TMP_TextUtilities.FindIntersectingLink` can never find a link if the Plane Distance is set to 0 in the canvas. In the attached video you see me changing the plane distance, and a script that logs the selected index. When the plane distance is 1 the indexes are valid, when the plane distance is 0 the indexes are all -1.

    https://streamable.com/j1mxc
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    A bug report which includes a Repro project is always best. That way, I don't have to spend too much time trying to reproduce issues or the scene setup needed to test.
     
  7. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Will do, thanks!