I’m trying to get at the rect of a ui element.
Not the rect transform, as that is the rect relative to the anchors.
I want the rect in screenspace or viewport space, if possible.
Anyone know if this is exposed in the api anywhere?
I’m trying to get at the rect of a ui element.
Not the rect transform, as that is the rect relative to the anchors.
I want the rect in screenspace or viewport space, if possible.
Anyone know if this is exposed in the api anywhere?
GUIElement.GetScreenRect might just be what you’re looking for. Your UI element likely inherits from GUIElement, so you can just call (element).GetScreenRect() for it. If you need viewport space, just use (camera).ScreentoViewportPoint(x,y) on your various points to convert them.