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 12 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

Attach both elements to a panel. Each element must have a valid _layout. Otherwise, this method might 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

Attach both elements to a panel. Each element must have a valid _layout. Otherwise, this method might return invalid results.