UI position set to wrong coords

So im try to create a tooltip that will will be displayed at the bottom right corner of the object the script is assigned to but I am having some odd issue with the position of the tooltips RectTransform.

Here is the code that sets the position of the tool tip:

RectTransform gameObjectsRect = gameObject.GetComponent<RectTransform>(); //The RectTransform the script is attached too
        Vector2 pos = new Vector2(gameObjectsRect.position.x + gameObjectsRect.rect.width/2, gameObjectsRect.position.y);
        Debug.Log(pos);
        rectTransform.position = new Vector3(pos.x, pos.y, gameObjectsRect.position.z);

But when the code is executed the postion of the tooltip is way off as you can see from the screenshot:
The weird thing is the Debug.log prints (137.0, 112.8) so why is the actual RectTransforms position so off?

Do you want the tooltip to be displayed in the game or in the scene UI ?

I believe that tooltip is displayed when you hover over a button so you might want to make a invisible button for that…

Sorry for the late reply, I already have a Event that displays the Tooltip object so that not the issue. The issue is more with the position of the Tooltip object.

The way i have it at the moment is i have a tooltip script that i attach to any UI object and when you hover over the UI object like a Image for an example the Tooltip gets created. This way i don’t need a trigger or a separate button. All im trying to do is position the new tooltip object that is not a child of any object and set the position to the center of the UI object the tooltip script is attached.

Hopefully that makes more sense.