Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetAspectRect

Reserve layout space for a rectangle with a specific aspect ratio.
Read time 2 minutesLast updated 4 days ago

Definition

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

GetAspectRect(float)

Reserve layout space for a rectangle with a specific aspect ratio.
public static Rect GetAspectRect(float aspect)

Parameters

aspect

The aspect ratio of the element (width / height).

Returns

Type

Description

RectThe rect for the control.

Remarks

GetAspectRect(float, GUIStyle)

Reserve layout space for a rectangle with a specific aspect ratio.
public static Rect GetAspectRect(float aspect, GUIStyle style)

Parameters

aspect

The aspect ratio of the element (width / height).

An optional style. If specified, the style's
padding
value will be added to the sizes of the returned rectangle & the style's
margin
values will be used for spacing.

Returns

Type

Description

RectThe rect for the control.

Remarks

GetAspectRect(float, GUILayoutOption[])

Reserve layout space for a rectangle with a specific aspect ratio.
public static Rect GetAspectRect(float aspect, params GUILayoutOption[] options)

Parameters

aspect

The aspect ratio of the element (width / height).

An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the
style
.
GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight

Returns

Type

Description

RectThe rect for the control.

Remarks

GetAspectRect(float, GUIStyle, GUILayoutOption[])

Reserve layout space for a rectangle with a specific aspect ratio.
public static Rect GetAspectRect(float aspect, GUIStyle style, params GUILayoutOption[] options)

Parameters

aspect

The aspect ratio of the element (width / height).

An optional style. If specified, the style's
padding
value will be added to the sizes of the returned rectangle & the style's
margin
values will be used for spacing.

An optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the
style
.
GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight

Returns

Type

Description

RectThe rect for the control.

Remarks