Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AlignRectToDevice

Align a local space rectangle to the pixel grid.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.IMGUIModule

AlignRectToDevice(Rect, int, int)

Align a local space rectangle to the pixel grid.
public static Rect AlignRectToDevice(Rect rect, out int widthInPixels, out int heightInPixels)

Parameters

rect


widthInPixels

Width, in pixel units, of the axis-aligned bounding box that encompasses the aligned points.

heightInPixels

Height, in pixel units, of the axis-aligned bounding box that encompasses the aligned points.

Returns

Type

Description

RectThe aligned rectangle in local space.

Remarks

Aligns the top-left and bottom-right corners of the provided local space rectangle to the pixel grid and returns the local space axis-aligned bounding box that encompasses those points.

AlignRectToDevice(Rect)

Align a local space rectangle to the pixel grid.
public static Rect AlignRectToDevice(Rect rect)

Parameters

rect

Returns

Type

Description

RectThe aligned rectangle in local space.

Remarks

Aligns the top-left and bottom-right corners of the provided local space rectangle to the pixel grid and returns the local space axis-aligned bounding box that encompasses those points.