UnityEssentials
Small but useful tools and features for Unity
Static Public Member Functions | List of all members
UnityEngine.RectTransformExtensions Class Reference

Extensions for the RectTransform component More...

Collaboration diagram for UnityEngine.RectTransformExtensions:
Collaboration graph

Static Public Member Functions

static Rect GetWorldRect (this RectTransform rt)
 Get the corners of the RectTransform in world space. More...
 
static MinMax01 GetAnchors (this RectTransform rt)
 The normalized position in the parent RectTransform that the corners is anchored to. More...
 
static void SetAnchors (this RectTransform rt, MinMax01 anchors)
 Sets the normalized position in the parent RectTransform that the corners is anchored to. More...
 
static RectTransform GetParent (this RectTransform rt)
 The RecTransform parent of the RectTransform. More...
 
static float GetWidth (this RectTransform rt)
 The width of the RectTransform, measured from the X position. More...
 
static float GetHeight (this RectTransform rt)
 The height of the RectTransform, measured from the Y position. More...
 
static Vector2 GetSize (this RectTransform rt)
 The width and the height of the RectTransform, measured from the (X,Y) position. More...
 
static void SetWidth (this RectTransform rt, float width)
 Sets the width of the RectTransform keeping the current anchors. More...
 
static void SetHeight (this RectTransform rt, float height)
 Sets the height of the RectTransform keeping the current anchors. More...
 
static void SetSize (this RectTransform rt, float width, float height)
 Sets the width and the height of the RectTransform keeping the current anchors. More...
 
static void SetSize (this RectTransform rt, Vector2 size)
 Sets the width and the height of the RectTransform keeping the current anchors. More...
 
static Vector2 GetLeft (this RectTransform rt)
 The center of the left edge. More...
 
static Vector2 GetRight (this RectTransform rt)
 The center of the right edge. More...
 
static Vector2 GetTop (this RectTransform rt)
 The center of the top edge. More...
 
static Vector2 GetBottom (this RectTransform rt)
 The center of the bottom edge. More...
 
static void SetLeft (this RectTransform rt, float distance)
 Sets the distance of the distance from the left edge to the parent's left edge regardless of the anchor position. More...
 
static void SetRight (this RectTransform rt, float distance)
 Sets the distance of the distance from the left edge to the parent's left edge regardless of the anchor position. More...
 
static void SetTop (this RectTransform rt, float top)
 Sets the distance of the distance from the top edge to the parent's top edge regardless of the anchor position. More...
 
static void SetBottom (this RectTransform rt, float distance)
 Sets the distance of the distance from the bottom edge to the parent's bottom edge regardless of the anchor position. More...
 
static void Left (this RectTransform rt, float distance)
 Moves the edge to a distance towards the center from the same edge of the parent. More...
 
static void Right (this RectTransform rt, float distance)
 Moves the edge to a distance towards the center from the same edge of the parent. More...
 
static void Top (this RectTransform rt, float distance)
 Moves the edge to a distance towards the center from the same edge of the parent. More...
 
static void Bottom (this RectTransform rt, float distance)
 Moves the edge to a distance towards the center from the same edge of the parent. More...
 
static void SetLeftFrom (this RectTransform rt, MinMax01 anchor, float distance)
 Repositions the requested edge relative to the passed anchor. More...
 
static void SetRightFrom (this RectTransform rt, MinMax01 anchor, float distance)
 Repositions the requested edge relative to the passed anchor. More...
 
static void SetTopFrom (this RectTransform rt, MinMax01 anchor, float distance)
 Repositions the requested edge relative to the passed anchor. More...
 
static void SetBottomFrom (this RectTransform rt, MinMax01 anchor, float distance)
 Repositions the requested edge relative to the passed anchor. More...
 
static void SetRelativeLeft (this RectTransform rt, float distance)
 Moves the edge to the requested position relative to the current position. More...
 
static void SetRelativeRight (this RectTransform rt, float distance)
 Moves the edge to the requested position relative to the current position. More...
 
static void SetRelativeTop (this RectTransform rt, float distance)
 Moves the edge to the requested position relative to the current position. More...
 
static void SetRelativeBottom (this RectTransform rt, float distance)
 Moves the edge to the requested position relative to the current position. More...
 
static void MoveLeft (this RectTransform rt, float left=0)
 Sets the position of the RectTransform relative to the parent's Left side, regardless of anchor setting. More...
 
static void MoveRight (this RectTransform rt, float right=0)
 Sets the position of the RectTransform relative to the parent's Right side, regardless of anchor setting. More...
 
static void MoveTop (this RectTransform rt, float top=0)
 Sets the position of the RectTransform relative to the parent's Top side, regardless of anchor setting. More...
 
static void MoveBottom (this RectTransform rt, float bottom=0)
 Sets the position of the RectTransform relative to the parent's Bottom side, regardless of anchor setting. More...
 
static void MoveLeftInside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the child left edge with the parent left edge. More...
 
static void MoveRightInside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the child left edge with the parent right edge. More...
 
static void MoveTopInside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the child left edge with the parent left top. More...
 
static void MoveBottomInside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the child left edge with the parent bottom edge. More...
 
static void MoveLeftOutside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the right edge with the parent left edge. More...
 
static void MoveRightOutside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the left edge with the parent right edge. More...
 
static void MoveTopOutside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the bottom edge with the parent top edge. More...
 
static void MoveBottomOutside (this RectTransform rt, float distance=0)
 Moves the RectTransform to align the top edge with the parent bottom edge. More...
 
static void Move (this RectTransform rt, float x, float y)
 Moves the RectTransform to the given point in parent space, considering (0, 0) to be the parent's lower-left corner. More...
 
static void Move (this RectTransform rt, Vector2 point)
 Moves the RectTransform to the given point in parent space, considering (0, 0) to be the parent's lower-left corner. More...
 
static void MoveInside (this RectTransform rt, float x, float y)
 Moves the RectTransform relative to the parent's lower-le1ft corner, respecting the RT's width and height. More...
 
static void MoveInside (this RectTransform rt, Vector2 point)
 Moves the RectTransform relative to the parent's lower-le1ft corner, respecting the RT's width and height. More...
 
static void MoveOutside (this RectTransform rt, float x, float y)
 Moves the RectTransform relative to the parent's lower-left corner, respecting the RT's width and height. More...
 
static void MoveOutside (this RectTransform rt, Vector2 point)
 Moves the RectTransform relative to the parent's lower-left corner, respecting the RT's width and height. More...
 
static void MoveFrom (this RectTransform rt, MinMax01 anchor, Vector2 point)
 Moves the RectTransform relative to an arbitrary anchor point. This is effectively like setting the anchor, then moving, then setting it back, but does so without potentially getting in the way of anything else. More...
 
static void MoveFrom (this RectTransform rt, MinMax01 anchor, float x, float y)
 Moves the RectTransform relative to an arbitrary anchor point. This is effectively like setting the anchor, then moving, then setting it back, but does so without potentially getting in the way of anything else. More...
 
static Vector2 ParentToChildSpace (this RectTransform rt, Vector2 point)
 Translates a point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner, into the same point relative to the RectTransform's current anchor. More...
 
static Vector2 ParentToChildSpace (this RectTransform rt, float x, float y)
 Translates a point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner, into the same point relative to the RectTransform's current anchor. More...
 
static Vector2 ChildToParentSpace (this RectTransform rt, float x, float y)
 Translates a point (presumably the RectTransform's anchoredPosition) into the same point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner. More...
 
static Vector2 ChildToParentSpace (this RectTransform rt, Vector2 point)
 Translates a point (presumably the RectTransform's anchoredPosition) into the same point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner. More...
 
static Vector2 ParentToAnchorSpace (this RectTransform rt, Vector2 point)
 Normalizes a point associated with the parent object into "Anchor Space", which is to say, (0, 0) represents the parent's lower-left-hand corner, and (1, 1) represents the upper-right-hand. More...
 
static Vector2 ParentToAnchorSpace (this RectTransform rt, float x, float y)
 Normalizes a point associated with the parent object into "Anchor Space", which is to say, (0, 0) represents the parent's lower-left-hand corner, and (1, 1) represents the upper-right-hand. More...
 
static Vector2 AnchorToParentSpace (this RectTransform rt, float x, float y)
 Translates a normalized "Anchor Space" coordinate into a real point on the parent's reference system. More...
 
static Vector2 AnchorToParentSpace (this RectTransform rt, Vector2 point)
 Translates a normalized "Anchor Space" coordinate into a real point on the parent's reference system. More...
 
static Vector2 AnchorOrigin (this RectTransform rt)
 The center of the rectangle the two anchors represent, which is the origin that a RectTransform's anchoredPosition is an offset of. More...
 
static Vector2 AnchorOrigin (MinMax01 anchor)
 The center of the rectangle the two anchors represent, which is the origin that a RectTransform's anchoredPosition is an offset of. More...
 
static Vector2 AnchorOriginParent (this RectTransform rt)
 Translates a RectTransform's anchor origin into Parent space. More...
 
static Canvas GetRootCanvas (this RectTransform rt)
 Returns the top-most-level canvas that this RectTransform is a child of. More...
 
static void SetProperties (this RectTransform rectTrans, RectTransform properties)
 Sets the RectTransform position, rotation and scale to the same values in the given RectTransform. More...
 
static void SetProperties (this RectTransform rectTrans, Vector2 anchoredPosition, Vector3 anchoredPosition3D, Vector2 anchorMax, Vector2 anchorMin, Vector2 offsetMax, Vector2 offsetMin, Vector2 pivot, Vector2 sizeDelta, Transform trans=null)
 Sets the transform properties to the given values. More...
 
static void SetLerp (this RectTransform self, RectTransform a, RectTransform b, float t)
 Linearly interpolates between two RectTransforms. More...
 

Detailed Description

Extensions for the RectTransform component

Definition at line 35 of file RectTransformExtensions.cs.

Member Function Documentation

◆ AnchorOrigin() [1/2]

static Vector2 UnityEngine.RectTransformExtensions.AnchorOrigin ( MinMax01  anchor)
static

The center of the rectangle the two anchors represent, which is the origin that a RectTransform's anchoredPosition is an offset of.

Returns
The center of the rectangle the two anchors represent.

Definition at line 724 of file RectTransformExtensions.cs.

◆ AnchorOrigin() [2/2]

static Vector2 UnityEngine.RectTransformExtensions.AnchorOrigin ( this RectTransform  rt)
static

The center of the rectangle the two anchors represent, which is the origin that a RectTransform's anchoredPosition is an offset of.

Returns
The center of the rectangle the two anchors represent.

Definition at line 716 of file RectTransformExtensions.cs.

Here is the caller graph for this function:

◆ AnchorOriginParent()

static Vector2 UnityEngine.RectTransformExtensions.AnchorOriginParent ( this RectTransform  rt)
static

Translates a RectTransform's anchor origin into Parent space.

Returns
The anchor origin in parent space.

Definition at line 736 of file RectTransformExtensions.cs.

◆ AnchorToParentSpace() [1/2]

static Vector2 UnityEngine.RectTransformExtensions.AnchorToParentSpace ( this RectTransform  rt,
float  x,
float  y 
)
static

Translates a normalized "Anchor Space" coordinate into a real point on the parent's reference system.

Parameters
xX coordinate of a normalized point set in "Anchor Space".
yY coordinate of a normalized point set in "Anchor Space".
Returns
The anchor space coordinate as a real point on the parent's reference

Definition at line 696 of file RectTransformExtensions.cs.

◆ AnchorToParentSpace() [2/2]

static Vector2 UnityEngine.RectTransformExtensions.AnchorToParentSpace ( this RectTransform  rt,
Vector2  point 
)
static

Translates a normalized "Anchor Space" coordinate into a real point on the parent's reference system.

Parameters
pointA normalized "Anchor Space" point of a normalized point set in "Anchor Space".
Returns
The anchor space coordinate as a real point on the parent's reference

Definition at line 705 of file RectTransformExtensions.cs.

◆ Bottom()

static void UnityEngine.RectTransformExtensions.Bottom ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to a distance towards the center from the same edge of the parent.

Parameters
distance

Definition at line 286 of file RectTransformExtensions.cs.

◆ ChildToParentSpace() [1/2]

static Vector2 UnityEngine.RectTransformExtensions.ChildToParentSpace ( this RectTransform  rt,
float  x,
float  y 
)
static

Translates a point (presumably the RectTransform's anchoredPosition) into the same point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner.

Parameters
xX coordinate of the point to translate.
yY coordinate of the point to translate.
Returns
The translated point.

Definition at line 643 of file RectTransformExtensions.cs.

◆ ChildToParentSpace() [2/2]

static Vector2 UnityEngine.RectTransformExtensions.ChildToParentSpace ( this RectTransform  rt,
Vector2  point 
)
static

Translates a point (presumably the RectTransform's anchoredPosition) into the same point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner.

Parameters
pointThe point to translate.
Returns
The translated point.

Definition at line 652 of file RectTransformExtensions.cs.

◆ GetAnchors()

static MinMax01 UnityEngine.RectTransformExtensions.GetAnchors ( this RectTransform  rt)
static

The normalized position in the parent RectTransform that the corners is anchored to.

Returns
A MinMax01 defining the normalized position in the parent RectTransform that the corners is anchored to.


Definition at line 57 of file RectTransformExtensions.cs.

◆ GetBottom()

static Vector2 UnityEngine.RectTransformExtensions.GetBottom ( this RectTransform  rt)
static

The center of the bottom edge.

Returns
The center of the bottom edge.

Definition at line 176 of file RectTransformExtensions.cs.

◆ GetHeight()

static float UnityEngine.RectTransformExtensions.GetHeight ( this RectTransform  rt)
static

The height of the RectTransform, measured from the Y position.

Returns
The height of the RectTransform, measured from the Y position.


Definition at line 94 of file RectTransformExtensions.cs.

◆ GetLeft()

static Vector2 UnityEngine.RectTransformExtensions.GetLeft ( this RectTransform  rt)
static

The center of the left edge.

Returns
The center of the left edge.

Definition at line 149 of file RectTransformExtensions.cs.

◆ GetParent()

static RectTransform UnityEngine.RectTransformExtensions.GetParent ( this RectTransform  rt)
static

The RecTransform parent of the RectTransform.

Returns
The RecTransform parent of the RectTransform.


Definition at line 76 of file RectTransformExtensions.cs.

◆ GetRight()

static Vector2 UnityEngine.RectTransformExtensions.GetRight ( this RectTransform  rt)
static

The center of the right edge.

Returns
The center of the right edge.

Definition at line 158 of file RectTransformExtensions.cs.

◆ GetRootCanvas()

static Canvas UnityEngine.RectTransformExtensions.GetRootCanvas ( this RectTransform  rt)
static

Returns the top-most-level canvas that this RectTransform is a child of.

Returns
The top-most-level canvas that this RectTransform is a child of, the root canvas.

Definition at line 745 of file RectTransformExtensions.cs.

◆ GetSize()

static Vector2 UnityEngine.RectTransformExtensions.GetSize ( this RectTransform  rt)
static

The width and the height of the RectTransform, measured from the (X,Y) position.

Returns
The width and the height of the RectTransform, measured from the (X,Y) position.


Definition at line 103 of file RectTransformExtensions.cs.

◆ GetTop()

static Vector2 UnityEngine.RectTransformExtensions.GetTop ( this RectTransform  rt)
static

The center of the top edge.

Returns
The center of the top edge.

Definition at line 167 of file RectTransformExtensions.cs.

◆ GetWidth()

static float UnityEngine.RectTransformExtensions.GetWidth ( this RectTransform  rt)
static

The width of the RectTransform, measured from the X position.

Returns
The width of the RectTransform, measured from the X position.


Definition at line 85 of file RectTransformExtensions.cs.

◆ GetWorldRect()

static Rect UnityEngine.RectTransformExtensions.GetWorldRect ( this RectTransform  rt)
static

Get the corners of the RectTransform in world space.

This method could behave weirdly in some cases.

Returns
A Rect defining the X and Y position, width and height of the RectTransform.

Definition at line 42 of file RectTransformExtensions.cs.

◆ Left()

static void UnityEngine.RectTransformExtensions.Left ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to a distance towards the center from the same edge of the parent.

Parameters
distance

Definition at line 262 of file RectTransformExtensions.cs.

◆ Move() [1/2]

static void UnityEngine.RectTransformExtensions.Move ( this RectTransform  rt,
float  x,
float  y 
)
static

Moves the RectTransform to the given point in parent space, considering (0, 0) to be the parent's lower-left corner.

Parameters
xX coordinate of the point to move the RectTransform to.
yY coordinate of the point to move the RectTransform to.

Definition at line 532 of file RectTransformExtensions.cs.

◆ Move() [2/2]

static void UnityEngine.RectTransformExtensions.Move ( this RectTransform  rt,
Vector2  point 
)
static

Moves the RectTransform to the given point in parent space, considering (0, 0) to be the parent's lower-left corner.

Parameters
pointThe point to move the RectTransform to.

Definition at line 541 of file RectTransformExtensions.cs.

◆ MoveBottom()

static void UnityEngine.RectTransformExtensions.MoveBottom ( this RectTransform  rt,
float  bottom = 0 
)
static

Sets the position of the RectTransform relative to the parent's Bottom side, regardless of anchor setting.

Parameters
bottomSets the position of the RectTransform relative to the parent's Bottom side.

Definition at line 428 of file RectTransformExtensions.cs.

◆ MoveBottomInside()

static void UnityEngine.RectTransformExtensions.MoveBottomInside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the child left edge with the parent bottom edge.

Parameters
distanceThe distance to the parent bottom edge.

Definition at line 476 of file RectTransformExtensions.cs.

◆ MoveBottomOutside()

static void UnityEngine.RectTransformExtensions.MoveBottomOutside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the top edge with the parent bottom edge.

Parameters
distanceThe distance between the edges

Definition at line 521 of file RectTransformExtensions.cs.

◆ MoveFrom() [1/2]

static void UnityEngine.RectTransformExtensions.MoveFrom ( this RectTransform  rt,
MinMax01  anchor,
float  x,
float  y 
)
static

Moves the RectTransform relative to an arbitrary anchor point. This is effectively like setting the anchor, then moving, then setting it back, but does so without potentially getting in the way of anything else.

Parameters
rt

Definition at line 605 of file RectTransformExtensions.cs.

Here is the call graph for this function:

◆ MoveFrom() [2/2]

static void UnityEngine.RectTransformExtensions.MoveFrom ( this RectTransform  rt,
MinMax01  anchor,
Vector2  point 
)
static

Moves the RectTransform relative to an arbitrary anchor point. This is effectively like setting the anchor, then moving, then setting it back, but does so without potentially getting in the way of anything else.

Definition at line 597 of file RectTransformExtensions.cs.

◆ MoveInside() [1/2]

static void UnityEngine.RectTransformExtensions.MoveInside ( this RectTransform  rt,
float  x,
float  y 
)
static

Moves the RectTransform relative to the parent's lower-le1ft corner, respecting the RT's width and height.

See MoveLeftInside for more information.

Parameters
xX coordinate of the point to move the RectTransform to.
yY coordinate of the point to move the RectTransform to.

Definition at line 554 of file RectTransformExtensions.cs.

◆ MoveInside() [2/2]

static void UnityEngine.RectTransformExtensions.MoveInside ( this RectTransform  rt,
Vector2  point 
)
static

Moves the RectTransform relative to the parent's lower-le1ft corner, respecting the RT's width and height.

See MoveLeftInside for more information.

Parameters
pointThe point to move the RectTransform to.

Definition at line 564 of file RectTransformExtensions.cs.

◆ MoveLeft()

static void UnityEngine.RectTransformExtensions.MoveLeft ( this RectTransform  rt,
float  left = 0 
)
static

Sets the position of the RectTransform relative to the parent's Left side, regardless of anchor setting.

Parameters
leftSets the position of the RectTransform relative to the parent's Left side.

Definition at line 395 of file RectTransformExtensions.cs.

◆ MoveLeftInside()

static void UnityEngine.RectTransformExtensions.MoveLeftInside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the child left edge with the parent left edge.

Parameters
distanceThe distance to the parent left edge.

Definition at line 452 of file RectTransformExtensions.cs.

◆ MoveLeftOutside()

static void UnityEngine.RectTransformExtensions.MoveLeftOutside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the right edge with the parent left edge.

Parameters
rt
distanceThe distance between the edges

Definition at line 497 of file RectTransformExtensions.cs.

◆ MoveOutside() [1/2]

static void UnityEngine.RectTransformExtensions.MoveOutside ( this RectTransform  rt,
float  x,
float  y 
)
static

Moves the RectTransform relative to the parent's lower-left corner, respecting the RT's width and height.

See MoveLeftOutside for more information.

Parameters
xX coordinate of the point to move the RectTransform to.
yY coordinate of the point to move the RectTransform to.

Definition at line 577 of file RectTransformExtensions.cs.

◆ MoveOutside() [2/2]

static void UnityEngine.RectTransformExtensions.MoveOutside ( this RectTransform  rt,
Vector2  point 
)
static

Moves the RectTransform relative to the parent's lower-left corner, respecting the RT's width and height.

See MoveLeftOutside for more information.

Parameters
pointThe point to move the RectTransform to.

Definition at line 587 of file RectTransformExtensions.cs.

◆ MoveRight()

static void UnityEngine.RectTransformExtensions.MoveRight ( this RectTransform  rt,
float  right = 0 
)
static

Sets the position of the RectTransform relative to the parent's Right side, regardless of anchor setting.

Parameters
rightSets the position of the RectTransform relative to the parent's Right side.

Definition at line 406 of file RectTransformExtensions.cs.

◆ MoveRightInside()

static void UnityEngine.RectTransformExtensions.MoveRightInside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the child left edge with the parent right edge.

Parameters
distanceThe distance to the parent right edge.

Definition at line 460 of file RectTransformExtensions.cs.

◆ MoveRightOutside()

static void UnityEngine.RectTransformExtensions.MoveRightOutside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the left edge with the parent right edge.

Parameters
distanceThe distance between the edges

Definition at line 505 of file RectTransformExtensions.cs.

◆ MoveTop()

static void UnityEngine.RectTransformExtensions.MoveTop ( this RectTransform  rt,
float  top = 0 
)
static

Sets the position of the RectTransform relative to the parent's Top side, regardless of anchor setting.

Parameters
topSets the position of the RectTransform relative to the parent's Top side.

Definition at line 417 of file RectTransformExtensions.cs.

◆ MoveTopInside()

static void UnityEngine.RectTransformExtensions.MoveTopInside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the child left edge with the parent left top.

Parameters
distanceThe distance to the parent top edge.

Definition at line 468 of file RectTransformExtensions.cs.

◆ MoveTopOutside()

static void UnityEngine.RectTransformExtensions.MoveTopOutside ( this RectTransform  rt,
float  distance = 0 
)
static

Moves the RectTransform to align the bottom edge with the parent top edge.

Parameters
distanceThe distance between the edges

Definition at line 513 of file RectTransformExtensions.cs.

◆ ParentToAnchorSpace() [1/2]

static Vector2 UnityEngine.RectTransformExtensions.ParentToAnchorSpace ( this RectTransform  rt,
float  x,
float  y 
)
static

Normalizes a point associated with the parent object into "Anchor Space", which is to say, (0, 0) represents the parent's lower-left-hand corner, and (1, 1) represents the upper-right-hand.

Parameters
xX coordinate of the point to normalize.
yY coordinate of the point to normalize.
Returns
The normalized point.

Definition at line 673 of file RectTransformExtensions.cs.

◆ ParentToAnchorSpace() [2/2]

static Vector2 UnityEngine.RectTransformExtensions.ParentToAnchorSpace ( this RectTransform  rt,
Vector2  point 
)
static

Normalizes a point associated with the parent object into "Anchor Space", which is to say, (0, 0) represents the parent's lower-left-hand corner, and (1, 1) represents the upper-right-hand.

Parameters
pointThe point to normalize.
Returns
The normalized point.

Definition at line 663 of file RectTransformExtensions.cs.

◆ ParentToChildSpace() [1/2]

static Vector2 UnityEngine.RectTransformExtensions.ParentToChildSpace ( this RectTransform  rt,
float  x,
float  y 
)
static

Translates a point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner, into the same point relative to the RectTransform's current anchor.

Parameters
xX coordinate of the point to translate.
yY coordinate of the point to translate.
Returns
The translated point.

Definition at line 627 of file RectTransformExtensions.cs.

◆ ParentToChildSpace() [2/2]

static Vector2 UnityEngine.RectTransformExtensions.ParentToChildSpace ( this RectTransform  rt,
Vector2  point 
)
static

Translates a point on the parent's frame of reference, with (0, 0) being the parent's lower-left hand corner, into the same point relative to the RectTransform's current anchor.

Parameters
pointThe point to translate.
Returns
The translated point.

Definition at line 617 of file RectTransformExtensions.cs.

◆ Right()

static void UnityEngine.RectTransformExtensions.Right ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to a distance towards the center from the same edge of the parent.

Parameters
distance

Definition at line 270 of file RectTransformExtensions.cs.

◆ SetAnchors()

static void UnityEngine.RectTransformExtensions.SetAnchors ( this RectTransform  rt,
MinMax01  anchors 
)
static

Sets the normalized position in the parent RectTransform that the corners is anchored to.


Definition at line 66 of file RectTransformExtensions.cs.

◆ SetBottom()

static void UnityEngine.RectTransformExtensions.SetBottom ( this RectTransform  rt,
float  distance 
)
static

Sets the distance of the distance from the bottom edge to the parent's bottom edge regardless of the anchor position.

Parameters
distance

Definition at line 247 of file RectTransformExtensions.cs.

◆ SetBottomFrom()

static void UnityEngine.RectTransformExtensions.SetBottomFrom ( this RectTransform  rt,
MinMax01  anchor,
float  distance 
)
static

Repositions the requested edge relative to the passed anchor.

Parameters
anchorThe anchor to get the relative from.
distanceThe distance to be moved to.

Definition at line 330 of file RectTransformExtensions.cs.

◆ SetHeight()

static void UnityEngine.RectTransformExtensions.SetHeight ( this RectTransform  rt,
float  height 
)
static

Sets the height of the RectTransform keeping the current anchors.

Definition at line 119 of file RectTransformExtensions.cs.

◆ SetLeft()

static void UnityEngine.RectTransformExtensions.SetLeft ( this RectTransform  rt,
float  distance 
)
static

Sets the distance of the distance from the left edge to the parent's left edge regardless of the anchor position.

Parameters
distance

Definition at line 214 of file RectTransformExtensions.cs.

◆ SetLeftFrom()

static void UnityEngine.RectTransformExtensions.SetLeftFrom ( this RectTransform  rt,
MinMax01  anchor,
float  distance 
)
static

Repositions the requested edge relative to the passed anchor.

Parameters
anchorThe anchor to get the relative from.
distanceThe distance to be moved to.

Definition at line 297 of file RectTransformExtensions.cs.

◆ SetLerp()

static void UnityEngine.RectTransformExtensions.SetLerp ( this RectTransform  self,
RectTransform  a,
RectTransform  b,
float  t 
)
static

Linearly interpolates between two RectTransforms.

When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b.

Definition at line 795 of file RectTransformExtensions.cs.

◆ SetProperties() [1/2]

static void UnityEngine.RectTransformExtensions.SetProperties ( this RectTransform  rectTrans,
RectTransform  properties 
)
static

Sets the RectTransform position, rotation and scale to the same values in the given RectTransform.

Parameters
propertiesThe RectTransform from which the position, rotation and scale will be copied.

Definition at line 759 of file RectTransformExtensions.cs.

◆ SetProperties() [2/2]

static void UnityEngine.RectTransformExtensions.SetProperties ( this RectTransform  rectTrans,
Vector2  anchoredPosition,
Vector3  anchoredPosition3D,
Vector2  anchorMax,
Vector2  anchorMin,
Vector2  offsetMax,
Vector2  offsetMin,
Vector2  pivot,
Vector2  sizeDelta,
Transform  trans = null 
)
static

Sets the transform properties to the given values.

Parameters
anchoredPositionThe anchoredPosition to be set in the RectTransform.
anchoredPosition3DThe anchoredPosition3D to be set in the RectTransform.
anchorMaxThe anchorMax to be set in the RectTransform.
anchorMinThe anchorMin to be set in the RectTransform.
offsetMaxThe offsetMax to be set in the RectTransform.
offsetMinThe offsetMin to be set in the RectTransform.
pivotThe pivot to be set in the RectTransform.
sizeDeltaThe sizeDelta to be set in the RectTransform.
transThe transform to copy the scale and rotation from (and the position).

Definition at line 777 of file RectTransformExtensions.cs.

◆ SetRelativeBottom()

static void UnityEngine.RectTransformExtensions.SetRelativeBottom ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to the requested position relative to the current position.

Using these functions repeatedly will result in unintuitive behavior, since the anchored position is getting changed with each call.

Parameters
rt
distanceThe distance you to displace the bottom edge.

Definition at line 375 of file RectTransformExtensions.cs.

◆ SetRelativeLeft()

static void UnityEngine.RectTransformExtensions.SetRelativeLeft ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to the requested position relative to the current position.

Using these functions repeatedly will result in unintuitive behavior, since the anchored position is getting changed with each call.

Parameters
rt
distanceThe distance you to displace the left edge.

Definition at line 345 of file RectTransformExtensions.cs.

◆ SetRelativeRight()

static void UnityEngine.RectTransformExtensions.SetRelativeRight ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to the requested position relative to the current position.

Using these functions repeatedly will result in unintuitive behavior, since the anchored position is getting changed with each call.

Parameters
rt
distanceThe distance you to displace the right edge.

Definition at line 355 of file RectTransformExtensions.cs.

◆ SetRelativeTop()

static void UnityEngine.RectTransformExtensions.SetRelativeTop ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to the requested position relative to the current position.

Using these functions repeatedly will result in unintuitive behavior, since the anchored position is getting changed with each call.

Parameters
rt
distanceThe distance you to displace the top edge.

Definition at line 365 of file RectTransformExtensions.cs.

◆ SetRight()

static void UnityEngine.RectTransformExtensions.SetRight ( this RectTransform  rt,
float  distance 
)
static

Sets the distance of the distance from the left edge to the parent's left edge regardless of the anchor position.

Parameters
distance

Definition at line 225 of file RectTransformExtensions.cs.

◆ SetRightFrom()

static void UnityEngine.RectTransformExtensions.SetRightFrom ( this RectTransform  rt,
MinMax01  anchor,
float  distance 
)
static

Repositions the requested edge relative to the passed anchor.

Parameters
anchorThe anchor to get the relative from.
distanceThe distance to be moved to.

Definition at line 308 of file RectTransformExtensions.cs.

◆ SetSize() [1/2]

static void UnityEngine.RectTransformExtensions.SetSize ( this RectTransform  rt,
float  width,
float  height 
)
static

Sets the width and the height of the RectTransform keeping the current anchors.

Parameters
widthThe desired width of the RectTransform
heightThe desired height of the RectTransform

Definition at line 129 of file RectTransformExtensions.cs.

◆ SetSize() [2/2]

static void UnityEngine.RectTransformExtensions.SetSize ( this RectTransform  rt,
Vector2  size 
)
static

Sets the width and the height of the RectTransform keeping the current anchors.

Parameters
sizeThe desired width (x) and height (y) of the RectTransform.

Definition at line 139 of file RectTransformExtensions.cs.

◆ SetTop()

static void UnityEngine.RectTransformExtensions.SetTop ( this RectTransform  rt,
float  top 
)
static

Sets the distance of the distance from the top edge to the parent's top edge regardless of the anchor position.

Parameters
distance

Definition at line 236 of file RectTransformExtensions.cs.

◆ SetTopFrom()

static void UnityEngine.RectTransformExtensions.SetTopFrom ( this RectTransform  rt,
MinMax01  anchor,
float  distance 
)
static

Repositions the requested edge relative to the passed anchor.

Parameters
anchorThe anchor to get the relative from.
distanceThe distance to be moved to.

Definition at line 319 of file RectTransformExtensions.cs.

◆ SetWidth()

static void UnityEngine.RectTransformExtensions.SetWidth ( this RectTransform  rt,
float  width 
)
static

Sets the width of the RectTransform keeping the current anchors.

Definition at line 111 of file RectTransformExtensions.cs.

◆ Top()

static void UnityEngine.RectTransformExtensions.Top ( this RectTransform  rt,
float  distance 
)
static

Moves the edge to a distance towards the center from the same edge of the parent.

Parameters
distance

Definition at line 278 of file RectTransformExtensions.cs.


The documentation for this class was generated from the following file: