Class RuntimePanelUtils
A collection of static methods that provide simple World, Screen, and Panel coordinate transformations.
Namespace: UnityEngine.UIElements
Syntax
public static class RuntimePanelUtils : object
Methods
CameraTransformWorldToPanel(IPanel, Vector3, Camera)
Transforms a world absolute position to its equivalent local coordinate on given panel,
using provided camera for internal WorldToScreen transformation.
The local coordinates reference panel.
The world position to transform.
The Camera used for internal WorldToScreen transformation.
Declaration
public static Vector2 CameraTransformWorldToPanel(IPanel panel, Vector3 worldPosition, Camera camera)
Parameters
Type | Name | Description |
---|---|---|
IPanel | panel | |
Vector3 | worldPosition | |
Camera | camera |
Returns
Type | Description |
---|---|
Vector2 |
CameraTransformWorldToPanelRect(IPanel, Vector3, Vector2, Camera)
Transforms a world position and size (in world units) to their equivalent local position and size
on given panel, using provided camera for internal WorldToScreen transformation.
The local coordinates reference panel.
The world position to transform.
The world size to transform. The object in the panel will appear to have
that size when compared to other 3D objects at neighboring positions.
The Camera used for internal WorldToScreen transformation.
Declaration
public static Rect CameraTransformWorldToPanelRect(IPanel panel, Vector3 worldPosition, Vector2 worldSize, Camera camera)
Parameters
Type | Name | Description |
---|---|---|
IPanel | panel | |
Vector3 | worldPosition | |
Vector2 | worldSize | |
Camera | camera |
Returns
Type | Description |
---|---|
Rect |
ResetDynamicAtlas(IPanel)
Resets the dynamic atlas of the panel. Textured elements will be repainted.
Declaration
public static void ResetDynamicAtlas(this IPanel panel)
Parameters
Type | Name | Description |
---|---|---|
IPanel | panel |
ScreenToPanel(IPanel, Vector2)
Transforms a screen absolute position to its equivalent local coordinate on given panel.
The local coordinates reference panel.
The screen position to transform.
Declaration
public static Vector2 ScreenToPanel(IPanel panel, Vector2 screenPosition)
Parameters
Type | Name | Description |
---|---|---|
IPanel | panel | |
Vector2 | screenPosition |
Returns
Type | Description |
---|---|
Vector2 |
SetTextureDirty(IPanel, Texture2D)
Notifies the dynamic atlas of the panel that the content of the provided texture has changed. If the dynamic atlas contains the texture, it will update it.
Declaration
public static void SetTextureDirty(this IPanel panel, Texture2D texture)
Parameters
Type | Name | Description |
---|---|---|
IPanel | panel | The current panel |
Texture2D | texture | The texture whose content has changed. |