Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

TextMesh Pro <link="ID"> always returns ID_01

Discussion in 'UGUI & TextMesh Pro' started by Peter77, Jul 5, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,394
    Unity 2019.4.20f1 and TextMesh Pro 2.1.6.

    This always returns
    ID_01
    :
    Code (CSharp):
    1. <link="terms"><style="link">Terms of Service</style></link>
    This returns the actual link ID
    terms
    :
    Code (CSharp):
    1. <style="link"><link="terms">Terms of Service</link></style>
    It only works when the link tag is inside the style tag, but not the other way around.

    Code (CSharp):
    1. // https://deltadreamgames.com/unity-tmp-hyperlinks/
    2. var index = TMP_TextUtilities.FindIntersectingLink(m_Text, Input.mousePosition, null);
    3. if (index == -1)
    4.     return;
    5.  
    6. var info = m_Text.textInfo.linkInfo[index];
    7. Debug.Log(info.GetLinkID());