Unity3d. How to get screen or world position of ui element

yourRectTransform.rect.center for the centre point in local space.

yourRectTransform.TransformPoint to convert to world space.

It is odd that RectTransform.GetWorldCorners doesn't work as stated. Per one of the other answers you need to call after Awake (so layout can occur).


I found that both GetWorldCorners and TransformPoint only work on Start(), not on Awake(), as if we'll have to wait for the content to be resized

    Vector3 min = referenceArea.rectTransform.TransformPoint(referenceArea.rectTransform.rect.min);
    Vector3 max = referenceArea.rectTransform.TransformPoint(referenceArea.rectTransform.rect.max);

    elementToResize.transform.localScale = new Vector3(Mathf.Abs(min.x - max.x) , Mathf.Abs(min.y - max.y), 1f);
    elementToResize.transform.position = referenceArea.rectTransform.TransformPoint(referenceArea.rectTransform.rect.center);

You can work with GetWorldCorners but only when using a child that has real dimensions. I got reasonable values for a child of a world space canvas.