# ChangeCoordinatesTo

> Transforms a point from the local space of an element to the local space of another element.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.0/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## ChangeCoordinatesTo(VisualElement, VisualElement, Vector2)

Transforms a point from the local space of an element to the local space of another element.

```csharp
public static Vector2 ChangeCoordinatesTo(this VisualElement src, VisualElement dest, Vector2 point)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): The element to use as a reference as the source local space.**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): The element to use as a reference as the destination local space.**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The point to transform, in the local space of the source element.

### Returns

| Type                                                              | Description                                        |
| ----------------------------------------------------------------- | -------------------------------------------------- |
| [Vector2](/engine/6000.0/script-reference/unityengine/vector2.md) | A 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](/engine/6000.0/script-reference/unityengine/uielements/visualelement/layout.md). 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.

```csharp
public static Rect ChangeCoordinatesTo(this VisualElement src, VisualElement dest, Rect rect)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): The element to use as a reference as the source local space.**** (\[VisualElement]\(/engine/6000.0/script-reference/unityengine/uielements/visualelement)): The element to use as a reference as the destination local space.**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): The rectangle to transform, in the local space of the source element.

### Returns

| Type                                                        | Description                                            |
| ----------------------------------------------------------- | ------------------------------------------------------ |
| [Rect](/engine/6000.0/script-reference/unityengine/rect.md) | A 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](/engine/6000.0/script-reference/unityengine/uielements/visualelement/layout.md). Otherwise, this method may return invalid results.
