Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ChangeCoordinatesTo

Transforms a point from the local space of an element to the local space of another element.
Read time 1 minuteLast updated 4 days ago

Definition

ChangeCoordinatesTo(VisualElement, VisualElement, Vector2)

Transforms a point from the local space of an element to the local space of another element.
public static Vector2 ChangeCoordinatesTo(this VisualElement src, VisualElement dest, Vector2 point)

Parameters

The element to use as a reference as the source local space.

The element to use as a reference as the destination local space.

point

The point to transform, in the local space of the source element.

Returns

Type

Description

Vector2A point in the local space of destination element.

Remarks

The elements both need to be attached to a panel and must receive a valid VisualElement.layout. Otherwise, this method may return invalid results.

ChangeCoordinatesTo(VisualElement, VisualElement, Rect)

Transforms a rectangle from the local space of an element to the local space of another element.
public static Rect ChangeCoordinatesTo(this VisualElement src, VisualElement dest, Rect rect)

Parameters

The element to use as a reference as the source local space.

The element to use as a reference as the destination local space.

rect

The rectangle to transform, in the local space of the source element.

Returns

Type

Description

RectA rectangle in the local space of destination element.

Remarks

The elements both need to be attached to a panel and have received a valid VisualElement.layout. Otherwise, this method may return invalid results.