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
public sealed class YauiPanel : MonoBehaviour
Properties
RenderMode
View Source
public PanelRenderMode RenderMode { get; set; }
WorldScale
View Source
public float WorldScale { get; set; }
EventCamera
View Source
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
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
public Matrix4x4 CanvasToWorld { get; }
SortOrder
View Source
public int SortOrder { get; set; }
ScaleMode
View Source
public PanelScaleMode ScaleMode { get; set; }
ConstantScale
View Source
public float ConstantScale { get; set; }
ReferenceResolution
View Source
public Vector2 ReferenceResolution { get; set; }
Match
View Source
public float Match { get; set; }
ScaleFactor
Canvas units per screen pixel is the inverse of this.
View Source
public float ScaleFactor { get; }
CanvasSize
Size of the panel in canvas units.
View Source
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
public bool TryScreenToCanvas(Vector2 screenPosition, out Vector2 canvas)
Returns
System.Boolean
Parameters
| Type | Name |
|---|---|
Vector2 | screenPosition |
Vector2 | canvas |
TryCanvasToScreen(Vector2, out Vector2)
Converts a point in canvas space to a screen position (pixels, origin at the bottom-left).
View Source
public bool TryCanvasToScreen(Vector2 canvas, out Vector2 screenPosition)
Returns
System.Boolean
Parameters
| Type | Name |
|---|---|
Vector2 | canvas |
Vector2 | screenPosition |
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
public YauiElement HitTest(Vector2 screenPosition)
Returns
Parameters
| Type | Name |
|---|---|
Vector2 | screenPosition |
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
public static void ForceUpdate()