| Parameter | Description |
|---|---|
| rectTransform | The RectTransform whose screen-space bounding box to compute. |
Rect A Rect describing the screen-space bounding box in pixels. Width and height are always non-negative.
Returns the screen-space axis-aligned bounding box of the given RectTransform.
The four world-space corners are projected to screen space using Camera.main. For Screen Space - Overlay canvases, the corners are already in screen-pixel coordinates and camera projection is skipped regardless of whether Camera.main is set, to avoid double-projecting them.
Note: This method uses Camera.main for camera projection. For canvases rendered by a specific non-main camera, use GetScreenRect(RectTransform,Camera) and pass the correct camera explicitly.
Additional resources: GetScreenRect(RectTransform,Camera).
| Parameter | Description |
|---|---|
| rectTransform | The RectTransform whose screen-space bounding box to compute. |
| camera | The camera to use for world-to-screen projection. If null, or if the RectTransform belongs to a Screen Space - Overlay canvas, camera projection is skipped and the world corners are used directly as screen coordinates. |
Rect A Rect describing the screen-space bounding box in pixels. Width and height are always non-negative.
Returns the screen-space axis-aligned bounding box of the given RectTransform, using the specified camera for projection.
The four world-space corners are projected to screen space using the provided camera. For Screen Space - Overlay canvases, projection is skipped regardless of the camera argument to avoid double-projecting coordinates that are already in screen space.
Use the no-argument overload GetScreenRect(RectTransform) to project using Camera.main.
Additional resources: GetScreenRect(RectTransform).