textMeshpro GetLinkID return incomplete id

this is the text found in the text mesh pro UGUI component

  1. <link=5ea79928-dfac-40d8-b53b-795c9ddb2fee>yes
  2. <link=a407ee81-d892-4853-a3a6-85623fef8744>no
    a script is attached to that component to return the id of the clicked link by GetLinkID
    after click “no” the debug log prints the right id, but click “yes” it only prints 5, which is starting character of the id,
    and have watched the text in the text mesh pro UGUI component before click and after it didn’t change, what could be wrong?
    the code
public void OnPointerClick(PointerEventData eventData)
{
    if (eventData.button == PointerEventData.InputButton.Left)
    {
        int linkIndex = TMP_TextUtilities.FindIntersectingLink(TMP, eventData.position, null);
        if (linkIndex > -1)
        {
            TMP_LinkInfo linkInfo = TMP.textInfo.linkInfo[linkIndex];
            string linkID = linkInfo.GetLinkID();
            Debug.Log(linkID);
        }
    }
}

Thanks.

The link ID should be in quotes.

  1. <link=“5ea79928-dfac-40d8-b53b-795c9ddb2fee”>yes
  2. <link=“a407ee81-d892-4853-a3a6-85623fef8744”>no
2 Likes

Solved, Thanks.
want to ask one other question if not mind:
need a highlight function to change the link color if the mouse is hovering it. change it back if not.
so the code now is working, but the TMP is in a scroll rect, the hierarchy is like
ScrollArea(Scroll Rect Component)
-TextMask(Mask Component to hide the text out the area)
–TextArea(TMP Component, ContentSizeFilter)
-ScrollBar
If the area is drag by mouse or scroll by mid button the highlight function doesn’t work, wait for sometime it works again.
any idea why is this happening?
code

private void LateUpdate() {
    if (isHoveringObject)
    {
        int linkIndex = TMP_TextUtilities.FindIntersectingLink(TMP, Input.mousePosition, null);
        if (linkIndex > -1)
        {
            if (currentSelected == linkIndex) return;
            if (currentSelected > -1 ) ChangeLinkColor(currentSelected, textColor);
            currentSelected = linkIndex;
            ChangeLinkColor(currentSelected, highlightColor);
        }
        else
        {
            if (currentSelected > -1) ChangeLinkColor(currentSelected, textColor);
            currentSelected = -1;
        }
    }
    else
    {
        if (currentSelected > -1) ChangeLinkColor(currentSelected, textColor);
        currentSelected = -1;
    }
}
public void OnPointerEnter(PointerEventData eventData) => isHoveringObject = true;
public void OnPointerExit(PointerEventData eventData) => isHoveringObject = false;

Thank you. This also solved my problem, but wanted to add that this is specifically double quotes. Single quotes didn’t work for me and I had to specifically use double.