# LocalToWorld

> Transforms a point from the local space of the element to panel coordinates.

## Definition

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

## LocalToWorld(VisualElement, Vector2)

Transforms a point from the local space of the element to panel coordinates.

```csharp
public static Vector2 LocalToWorld(this VisualElement ele, Vector2 p)
```

### Parameters

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

### Returns

| Type                                                              | Description                   |
| ----------------------------------------------------------------- | ----------------------------- |
| [Vector2](/engine/6000.6/script-reference/unityengine/vector2.md) | A point in panel coordinates. |

### Remarks

Attach the element to a panel. The element must have a valid [\_layout](/engine/6000.6/script-reference/unityengine/uielements/visualelement/layout.md). Otherwise, this method might return invalid results.

If the element's transform contains 3D information, use `ele.worldTransform.MultiplyPoint3x4(p)` to get a proper 3D transformation.

## LocalToWorld(VisualElement, Rect)

Transforms a rectangle from the local space of the element to panel coordinates.

```csharp
public static Rect LocalToWorld(this VisualElement ele, Rect r)
```

### Parameters

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

### Returns

| Type                                                        | Description                       |
| ----------------------------------------------------------- | --------------------------------- |
| [Rect](/engine/6000.6/script-reference/unityengine/rect.md) | A rectangle in panel coordinates. |

### Remarks

Attach the element to a panel. The element must have a valid [\_layout](/engine/6000.6/script-reference/unityengine/uielements/visualelement/layout.md). Otherwise, this method might return invalid results.
