Skip to main content

Class YauiPanel

The root of a YAUI tree. Draws its Yaui.YauiElement and the elements below it as a screen space overlay, sized like uGUI's CanvasScaler (scale with screen size).

Assembly: Yaui.dll​
View Source​
Declaration
public sealed class YauiPanel : MonoBehaviour

Properties​

RenderMode​

View Source​
Declaration
public PanelRenderMode RenderMode { get; set; }

WorldScale​

View Source​
Declaration
public float WorldScale { get; set; }

EventCamera​

View Source​
Declaration
public Camera EventCamera { get; set; }

SceneViewCanvasToWorld​

Where the panel appears in the Scene view: world space panels at Yaui.YauiPanel.CanvasToWorld, overlay panels like uGUI's overlay canvases, one world unit per screen pixel with the bottom-left at the origin.

View Source​
Declaration
public Matrix4x4 SceneViewCanvasToWorld { get; }

CanvasToWorld​

World space: canvas space (origin at the top-left, Y down) to world space. The panel is centered on the Transform in its XY plane.

View Source​
Declaration
public Matrix4x4 CanvasToWorld { get; }

SortOrder​

View Source​
Declaration
public int SortOrder { get; set; }

ScaleMode​

View Source​
Declaration
public PanelScaleMode ScaleMode { get; set; }

ConstantScale​

View Source​
Declaration
public float ConstantScale { get; set; }

ReferenceResolution​

View Source​
Declaration
public Vector2 ReferenceResolution { get; set; }

Match​

View Source​
Declaration
public float Match { get; set; }

ScaleFactor​

Canvas units per screen pixel is the inverse of this.

View Source​
Declaration
public float ScaleFactor { get; }

CanvasSize​

Size of the panel in canvas units.

View Source​
Declaration
public Vector2 CanvasSize { get; }

Methods​

TryScreenToCanvas(Vector2, out Vector2)​

Converts a screen position (pixels, origin at the bottom-left) to canvas space (origin at the top-left, Y down). World space panels are seen through Yaui.YauiPanel.EventCamera; false if it does not see the panel's plane there.

View Source​
Declaration
public bool TryScreenToCanvas(Vector2 screenPosition, out Vector2 canvas)
Returns​

System.Boolean

Parameters​
TypeName
Vector2screenPosition
Vector2canvas

TryCanvasToScreen(Vector2, out Vector2)​

Converts a point in canvas space to a screen position (pixels, origin at the bottom-left).

View Source​
Declaration
public bool TryCanvasToScreen(Vector2 canvas, out Vector2 screenPosition)
Returns​

System.Boolean

Parameters​
TypeName
Vector2canvas
Vector2screenPosition

HitTest(Vector2)​

The topmost element that receives hits at a screen position (pixels, origin at the bottom-left), as last rendered, or null. See Yaui.YauiElement.RaycastTarget.

View Source​
Declaration
public YauiElement HitTest(Vector2 screenPosition)
Returns​

Yaui.YauiElement

Parameters​
TypeName
Vector2screenPosition

ForceUpdate()​

Lays out, generates texts and uploads all panels now, so that Yaui.YauiElement.LayoutRect and hit tests reflect the changes made so far in this frame (like uGUI's Canvas.ForceUpdateCanvases). Costs the overlap with other work that the frame pipeline gets.

View Source​
Declaration
public static void ForceUpdate()