C# Класс UnityEngine.RectTransformUtility

Utility class containing helper methods for working with RectTransform.

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CalculateRelativeRectTransformBounds ( Transform trans ) : Bounds
CalculateRelativeRectTransformBounds ( Transform root, Transform child ) : Bounds
FlipLayoutAxes ( RectTransform rect, bool keepPositioning, bool recursive ) : void

Flips the horizontal and vertical axes of the RectTransform size and alignment, and optionally its children as well.

FlipLayoutOnAxis ( RectTransform rect, int axis, bool keepPositioning, bool recursive ) : void

Flips the alignment of the RectTransform along the horizontal or vertical axis, and optionally its children as well.

PixelAdjustPoint ( Vector2 point, Transform elementTransform, Canvas canvas ) : Vector2

Convert a given point in screen space into a pixel correct point.

PixelAdjustRect ( RectTransform rectTransform, Canvas canvas ) : Rect

Given a rect transform, return the corner points in pixel accurate coordinates.

RectangleContainsScreenPoint ( RectTransform rect, Vector2 screenPoint ) : bool
RectangleContainsScreenPoint ( RectTransform rect, Vector2 screenPoint, Camera cam ) : bool

Does the RectTransform contain the screen point as seen from the given camera?

ScreenPointToLocalPointInRectangle ( RectTransform rect, Vector2 screenPoint, Camera cam, Vector2 &localPoint ) : bool
ScreenPointToRay ( Camera cam, Vector2 screenPos ) : Ray
ScreenPointToWorldPointInRectangle ( RectTransform rect, Vector2 screenPoint, Camera cam, Vector3 &worldPoint ) : bool
WorldToScreenPoint ( Camera cam, Vector3 worldPoint ) : Vector2

Приватные методы

Метод Описание
GetTransposed ( Vector2 input ) : Vector2
INTERNAL_CALL_PixelAdjustPoint ( Vector2 &point, Transform elementTransform, Canvas canvas, Vector2 &value ) : void
INTERNAL_CALL_PixelAdjustRect ( RectTransform rectTransform, Canvas canvas, Rect &value ) : void
INTERNAL_CALL_RectangleContainsScreenPoint ( RectTransform rect, Vector2 &screenPoint, Camera cam ) : bool
RectTransformUtility ( ) : System

Описание методов

CalculateRelativeRectTransformBounds() публичный статический Метод

public static CalculateRelativeRectTransformBounds ( Transform trans ) : Bounds
trans Transform
Результат Bounds

CalculateRelativeRectTransformBounds() публичный статический Метод

public static CalculateRelativeRectTransformBounds ( Transform root, Transform child ) : Bounds
root Transform
child Transform
Результат Bounds

FlipLayoutAxes() публичный статический Метод

Flips the horizontal and vertical axes of the RectTransform size and alignment, and optionally its children as well.

public static FlipLayoutAxes ( RectTransform rect, bool keepPositioning, bool recursive ) : void
rect RectTransform The RectTransform to flip.
keepPositioning bool Flips around the pivot if true. Flips within the parent rect if false.
recursive bool Flip the children as well?
Результат void

FlipLayoutOnAxis() публичный статический Метод

Flips the alignment of the RectTransform along the horizontal or vertical axis, and optionally its children as well.

public static FlipLayoutOnAxis ( RectTransform rect, int axis, bool keepPositioning, bool recursive ) : void
rect RectTransform The RectTransform to flip.
axis int The axis to flip along. 0 is horizontal and 1 is vertical.
keepPositioning bool Flips around the pivot if true. Flips within the parent rect if false.
recursive bool Flip the children as well?
Результат void

PixelAdjustPoint() публичный статический Метод

Convert a given point in screen space into a pixel correct point.

public static PixelAdjustPoint ( Vector2 point, Transform elementTransform, Canvas canvas ) : Vector2
point Vector2
elementTransform Transform
canvas Canvas
Результат Vector2

PixelAdjustRect() публичный статический Метод

Given a rect transform, return the corner points in pixel accurate coordinates.

public static PixelAdjustRect ( RectTransform rectTransform, Canvas canvas ) : Rect
rectTransform RectTransform
canvas Canvas
Результат Rect

RectangleContainsScreenPoint() публичный статический Метод

public static RectangleContainsScreenPoint ( RectTransform rect, Vector2 screenPoint ) : bool
rect RectTransform
screenPoint Vector2
Результат bool

RectangleContainsScreenPoint() публичный статический Метод

Does the RectTransform contain the screen point as seen from the given camera?

public static RectangleContainsScreenPoint ( RectTransform rect, Vector2 screenPoint, Camera cam ) : bool
rect RectTransform The RectTransform to test with.
screenPoint Vector2 The screen point to test.
cam Camera The camera from which the test is performed from. (Optional)
Результат bool

ScreenPointToLocalPointInRectangle() публичный статический Метод

public static ScreenPointToLocalPointInRectangle ( RectTransform rect, Vector2 screenPoint, Camera cam, Vector2 &localPoint ) : bool
rect RectTransform
screenPoint Vector2
cam Camera
localPoint Vector2
Результат bool

ScreenPointToRay() публичный статический Метод

public static ScreenPointToRay ( Camera cam, Vector2 screenPos ) : Ray
cam Camera
screenPos Vector2
Результат Ray

ScreenPointToWorldPointInRectangle() публичный статический Метод

public static ScreenPointToWorldPointInRectangle ( RectTransform rect, Vector2 screenPoint, Camera cam, Vector3 &worldPoint ) : bool
rect RectTransform
screenPoint Vector2
cam Camera
worldPoint Vector3
Результат bool

WorldToScreenPoint() публичный статический Метод

public static WorldToScreenPoint ( Camera cam, Vector3 worldPoint ) : Vector2
cam Camera
worldPoint Vector3
Результат Vector2