Drawing an Image over a line of text

I’m currently using the link system in TMP to organize my separate save files (Thank you Stephan), but I’m having a whole lot of trouble with this one aspect. I’m wanting to draw a simple Image piece (I just set it as active when needed) over the text line to act as a suggestion box. I got this to slightly work. But my problem was, as I went down the lines, the box would go a little bit above the line each time. So basically, when I was at the bottom the box would be three lines above. Here’s what I mean:

As you can see, kinda weird what it’s doing. I originally thought I could put the image outside the canvas perhaps and transform a point, but this did not work.

Again take a look at the TextInfoDebugTool.cs script and how it draws the bounds for individual lines.

I did, but even when transforming the point as shown in the debug, I get that same problem:

        if (GetCurrentLinkIndex() > -1)
        {
            var lineInfo = saveText.textInfo.lineInfo[GetCurrentLinkIndex()];
            var textInfo = saveText.textInfo;

            float ascender = lineInfo.ascender;
            float descender = lineInfo.descender;

            Vector3 bottomLeft = saveText.transform.TransformPoint(new Vector3(textInfo.characterInfo[lineInfo.firstCharacterIndex].bottomLeft.x, descender, 0));
            Vector3 topLeft = saveText.transform.TransformPoint(new Vector3(textInfo.characterInfo[lineInfo.firstCharacterIndex].bottomLeft.x, ascender, 0));
            Vector3 topRight = saveText.transform.TransformPoint(new Vector3(textInfo.characterInfo[lineInfo.lastCharacterIndex].topRight.x, ascender, 0));
            Vector3 bottomRight = saveText.transform.TransformPoint(new Vector3(textInfo.characterInfo[lineInfo.lastCharacterIndex].topRight.x, descender, 0));

            LoadSelectionArrow(true, topLeft.x, topLeft.y);
        }

Maybe I’m not seeing something I should, I seem to be terrible at this

Well, silly me. The problem was within my code. When loading it, I was drawing it based on a weird set of wrong local coords. Used a line renderer to draw the image and it works like a charm. :slight_smile: Thanks! You seem to be the most helpful developer on here.