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?