Class RectTransformExtension
Namespace: AppMana.InteractionToolkit.MaterialUI
Static class with RectTransform extension methods.
public static class RectTransformExtension
Inheritance
object ← RectTransformExtension
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
GetLocalPositionRegardlessOfPivot(RectTransform)
Gets the local position regardless of pivot.
public static Vector3 GetLocalPositionRegardlessOfPivot(this RectTransform rectTransform)
Parameters
rectTransform RectTransform
The rect transform.
Returns
Vector3
The position in local space.
GetPositionRegardlessOfPivot(RectTransform)
Gets the position regardless of pivot.
public static Vector3 GetPositionRegardlessOfPivot(this RectTransform rectTransform)
Parameters
rectTransform RectTransform
The rect transform.
Returns
Vector3
The position in world space.
GetProperSize(RectTransform)
Sometimes sizeDelta works, sometimes rect works, sometimes neither work and you need to get the layout properties. This method provides a simple way to get the size of a RectTransform, no matter what's driving it or what the anchor values are.
public static Vector2 GetProperSize(this RectTransform rectTransform)
Parameters
rectTransform RectTransform
The rect transform to check.
Returns
Vector2
The proper size of the RectTransform.
GetRootCanvas(RectTransform)
Gets the root canvas of a RectTransform.
public static Canvas GetRootCanvas(this RectTransform rectTransform)
Parameters
rectTransform RectTransform
The rect transform to get the root canvas of.
Returns
Canvas
GetWorldSize(RectTransform)
public static Rect GetWorldSize(this RectTransform rectTransform)
Parameters
rectTransform RectTransform
Returns
Rect
SetAnchorX(RectTransform, float, float)
Sets the x value of a RectTransform's anchor.
public static void SetAnchorX(this RectTransform rectTransform, float min, float max)
Parameters
rectTransform RectTransform
The rect transform.
min float
The minimum.
max float
The maximum.
SetAnchorY(RectTransform, float, float)
Sets the y value of a RectTransform's anchor
public static void SetAnchorY(this RectTransform rectTransform, float min, float max)
Parameters
rectTransform RectTransform
The rect transform.
min float
The minimum.
max float
The maximum.
