I am new to Unity And C#. Usually I can get answers online when I encountered problems, but this one I couldn't find any clue.
I know there's a way to detect text by using TextUtilities something like the following snippets:
string hoveredWord;
int wordIndex = TMP_TextUtilities.FindIntersectingWord(description, Input.mousePosition, null);
if (wordIndex != -1)
{
hoveredWord = description.textInfo.wordInfo[wordIndex].GetWord();
Debug.Log("hover on " + hoveredWord);
}
However, it can only print out words, it prints out Nothing while hovering on an inline sprite. I've also tried use TMP_SpriteAsset, but it doesn't seem there's a similar method as TextUtilities.
I'd like to make an effect similar to what you can see in this video : at 0:37, the textbox/tooltip is triggered while the mouse is hovering on the inline sprite.
My question is, is there any ways to GET any info of inline sprites in a TextMeshPro, especially the sprite name or sprite index while hovering over it? Or is there other way that I can implement the effect by using other ways?