Class UICanvas
Root of the UI structure. Renders GUI and handles input events forwarding.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[ActorContextMenu("New/UI/UI Canvas")]
[ActorToolbox("GUI")]
[Unmanaged]
public sealed class UICanvas : Actor, ISerializable
Constructors
UICanvas()
Fields
CalculateRay
The current implementation of the UICanvas.CalculateRayDelegate used to calculate the mouse ray in 3D from the 2D location. Cannot be null.
Declaration
public static UICanvas.CalculateRayDelegate CalculateRay
Field Value
UICanvas.CalculateRayDelegate
|
Properties
Bounds
Gets the world-space oriented bounding box that contains a 3D canvas.
Declaration
public OrientedBoundingBox Bounds { get; }
Property Value
OrientedBoundingBox
|
Distance
Gets or sets the distance from the RenderCamera to place the plane with GUI. If the screen is resized, changes resolution, or the camera frustum changes, the Canvas will automatically change size to match as well.
Declaration
[EditorOrder(60)]
[Limit(0.01F, 3.40282347E+38F, 1F)]
[EditorDisplay("Canvas", null)]
[VisibleIf("Editor_IsCameraSpace", false)]
[Tooltip("Distance from the RenderCamera to place the plane with GUI. If the screen is resized, changes resolution, or the camera frustum changes, the Canvas will automatically change size to match as well.")]
public float Distance { get; set; }
Property Value
System.Single
|
GUI
Gets the canvas GUI root control.
Declaration
public CanvasRootControl GUI { get; }
Property Value
FlaxEngine.GUI.CanvasRootControl
|
IgnoreDepth
Gets or sets a value indicating whether ignore scene depth when rendering the GUI (scene objects won't cover the interface).
Declaration
[EditorOrder(30)]
[EditorDisplay("Canvas", null)]
[VisibleIf("Editor_Is3D", false)]
[Tooltip("If checked, scene depth will be ignored when rendering the GUI (scene objects won't cover the interface).")]
public bool IgnoreDepth { get; set; }
Property Value
System.Boolean
|
Is2D
Gets a value indicating whether canvas is 2D (screen-space).
Declaration
public bool Is2D { get; }
Property Value
System.Boolean
|
Is3D
Gets a value indicating whether canvas is 3D (world-space or camera-space).
Declaration
public bool Is3D { get; }
Property Value
System.Boolean
|
NavigateDown
NavigateLeft
NavigateRight
NavigateSubmit
NavigateUp
NavigationInputRepeatDelay
NavigationInputRepeatRate
Order
Gets or sets the canvas rendering and input events gather order. Created GUI canvas objects are sorted before rendering (from the lowest order to the highest order). Canvas with the highest order can handle input event first.
Declaration
[EditorOrder(14)]
[EditorDisplay("Canvas", null)]
[Tooltip("The canvas rendering and input events gather order. Created GUI canvas objects are sorted before rendering (from the lowest order to the highest order). Canvas with the highest order can handle input event first.")]
public int Order { get; set; }
Property Value
System.Int32
|
ReceivesEvents
Gets or sets a value indicating whether canvas can receive the input events.
Declaration
[EditorOrder(15)]
[EditorDisplay("Canvas", null)]
[Tooltip("If checked, canvas can receive the input events.")]
public bool ReceivesEvents { get; set; }
Property Value
System.Boolean
|
RenderCamera
Gets or sets the camera used to place the GUI when render mode is set to CameraSpace or WorldSpaceFaceCamera.
Declaration
[EditorOrder(50)]
[EditorDisplay("Canvas", null)]
[VisibleIf("Editor_UseRenderCamera", false)]
[Tooltip("Camera used to place the GUI when RenderMode is set to CameraSpace or WorldSpaceFaceCamera.")]
public Camera RenderCamera { get; set; }
Property Value
Camera
|
RenderLocation
Gets or sets the canvas rendering location within rendering pipeline. Used only in CameraSpace or WorldSpace or WorldSpaceFaceCamera.
Declaration
[EditorOrder(13)]
[EditorDisplay("Canvas", null)]
[VisibleIf("Editor_Is3D", false)]
[Tooltip("Canvas rendering location within the rendering pipeline. Change this if you want GUI to affect the lighting or post processing effects like bloom.")]
public PostProcessEffectLocation RenderLocation { get; set; }
Property Value
PostProcessEffectLocation
|
RenderMode
Gets or sets the canvas rendering mode.
Declaration
[EditorOrder(10)]
[EditorDisplay("Canvas", null)]
[Tooltip("Canvas rendering mode.")]
public CanvasRenderMode RenderMode { get; set; }
Property Value
CanvasRenderMode
|
Size
Gets or sets the size of the canvas. Used only in WorldSpace or WorldSpaceFaceCamera.
Declaration
[EditorOrder(20)]
[EditorDisplay("Canvas", null)]
[VisibleIf("Editor_IsWorldSpace", false)]
[Tooltip("Canvas size.")]
public Float2 Size { get; set; }
Property Value
Float2
|
Methods
DefaultCalculateRay(ref Float2, out Ray)
The default implementation of the UICanvas.CalculateRayDelegate that uses the MainCamera to evaluate the 3D ray.
Declaration
public static void DefaultCalculateRay(ref Float2 location, out Ray ray)
Parameters
Float2
location
The location in screen-space. |
Ray
ray
The output ray in world-space. |
Finalize()
Finalizes an instance of the UICanvas class.
Declaration
protected override void Finalize()
Overrides
GetWorldMatrix(out Matrix)
Gets the world matrix used to transform the GUI from the local space to the world space. Handles canvas rendering mode
Declaration
public void GetWorldMatrix(out Matrix world)
Parameters
Matrix
world
The world. |
GetWorldMatrix(Vector3, out Matrix)
Gets the world matrix used to transform the GUI from the local space to the world space. Handles canvas rendering mode
Declaration
public void GetWorldMatrix(Vector3 viewOrigin, out Matrix world)
Parameters
Vector3
viewOrigin
The view origin (when using relative-to-camera rendering). |
Matrix
world
The world. |