Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


LocalToWorld

Transforms a point from the local space of the element to panel coordinates.
Read time 1 minuteLast updated 10 days ago

Definition

LocalToWorld(VisualElement, Vector2)

Transforms a point from the local space of the element to panel coordinates.
public static Vector2 LocalToWorld(this VisualElement ele, Vector2 p)

Parameters

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

The point to transform, in local space.

Returns

Type

Description

Vector2A point in panel coordinates.

Remarks

Attach the element to a panel. The element must have a valid _layout. 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.
public static Rect LocalToWorld(this VisualElement ele, Rect r)

Parameters

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

The rectangle to transform, in local space.

Returns

Type

Description

RectA rectangle in panel coordinates.

Remarks

Attach the element to a panel. The element must have a valid _layout. Otherwise, this method might return invalid results.